A friction-less and extensioble serializers abstraction layer.
The main public api consists in two functions:
encode: that takes the clojure data and the serialization format
as keyword and returns serialized bytes.decode: just does the reverse operation. It takes the a byte array
and returns a deserialized data.If something wrong is happens in the process, the underlying library used for serialize or deserialize can raise exceptions.
Here an simple example serializing and deserializing a clojure hash-map using json format:
(require '[catacumba.serializers :as sz])
(-> (sz/encode {:foo 2} :json)
(sz/bytes->str))
;; => "{\"foo\": 2}"
(sz/decode some-data :json)
;; => {:foo 2}
A friction-less and extensioble serializers abstraction layer.
The main public api consists in two functions:
- `encode`: that takes the clojure data and the serialization format
as keyword and returns serialized bytes.
- `decode`: just does the reverse operation. It takes the a byte array
and returns a deserialized data.
If something wrong is happens in the process, the underlying library
used for serialize or deserialize can raise exceptions.
Here an simple example serializing and deserializing a clojure
hash-map using json format:
```
(require '[catacumba.serializers :as sz])
(-> (sz/encode {:foo 2} :json)
(sz/bytes->str))
;; => "{\"foo\": 2}"
(sz/decode some-data :json)
;; => {:foo 2}
```
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |