Liking cljdoc? Tell your friends :D

telsos.lib.edn-json


create-json-edn-decoderclj/s

(create-json-edn-decoder schema)
(create-json-edn-decoder schema
                         {:keys [on-invalid-fn]
                          :or {on-invalid-fn malli/on-invalid-throw-ex-info}})

Creates a decoder that transforms JsonEdn-compatible EDN to domain EDN (valid per schema).

The output is validated against the schema after decoding. Throws validation exception on failure.

Uses json-edn-registry which includes :inst and :local-date schemas.

Decoders accept values already in target type (pass through) or strings (convert). Other types will throw an error.

Example: (def decode (create-json-edn-decoder [:map [:id :uuid] [:name :string]])) (decode {"id" "550e8400-e29b-41d4-a716-446655440000" "name" "John"}) ;; => {:id #uuid "550e8400-e29b-41d4-a716-446655440000" :name "John"}

Creates a decoder that transforms JsonEdn-compatible EDN to domain EDN (valid per schema).

The output is validated against the schema after decoding.
Throws validation exception on failure.

Uses json-edn-registry which includes :inst and :local-date schemas.

Decoders accept values already in target type (pass through) or strings (convert).
Other types will throw an error.

Example:
  (def decode (create-json-edn-decoder [:map [:id :uuid] [:name :string]]))
  (decode {"id" "550e8400-e29b-41d4-a716-446655440000" "name" "John"})
  ;; => {:id #uuid "550e8400-e29b-41d4-a716-446655440000" :name "John"}
raw docstring

create-json-edn-encoderclj/s

(create-json-edn-encoder schema)
(create-json-edn-encoder schema
                         {:keys [on-invalid-fn]
                          :or {on-invalid-fn malli/on-invalid-throw-ex-info}})

Creates an encoder that transforms domain EDN (valid per schema) to JsonEdn-compatible EDN.

The input is validated against the schema before encoding. Throws ex-info on validation failure.

Uses json-edn-registry which includes :inst and :local-date schemas.

Example: (def encode (create-json-edn-encoder [:map [:id :uuid] [:name :string]])) (encode {:id #uuid "..." :name "John"}) ;; => {"id" "uuid-string" "name" "John"}

Creates an encoder that transforms domain EDN (valid per schema) to JsonEdn-compatible EDN.

The input is validated against the schema before encoding.
Throws ex-info on validation failure.

Uses json-edn-registry which includes :inst and :local-date schemas.

Example:
  (def encode (create-json-edn-encoder [:map [:id :uuid] [:name :string]]))
  (encode {:id #uuid "..." :name "John"})
  ;; => {"id" "uuid-string" "name" "John"}
raw docstring

json-edn->stringclj/s

(json-edn->string json-edn)

JsonEdnclj/s


string->json-ednclj/s

(string->json-edn s)

the-JsonEdnclj/s

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close