JSV.Codec (jsv v0.5.1)
View SourceJSON encoder/decoder based on available implementation.
First looks for Jason, then Poision, then JSON (available since Elixir 1.18).
Summary
Functions
Returns the module used for JSON encoding and decoding.
Equivalent to JSON.decode/1
.
Equivalent to JSON.decode!/1
.
Equivalent to JSON.encode!/1
.
Equivalent to JSON.encode_to_iodata!/1
.
Equivalent to JSON.encode_to_iodata!/1
.
Equivalent to JSON.encode!/1
with map keys ordered according to the sorter
function.
Like format_ordered!/1
Equivalent to JSON.encode_to_iodata!/1
.
Types
Functions
@spec codec() :: module()
Returns the module used for JSON encoding and decoding.
Equivalent to JSON.decode/1
.
Equivalent to JSON.decode!/1
.
Equivalent to JSON.encode!/1
.
Equivalent to JSON.encode_to_iodata!/1
.
Equivalent to JSON.encode_to_iodata!/1
.
@spec format_ordered!(term(), key_sorter()) :: binary()
Equivalent to JSON.encode!/1
with map keys ordered according to the sorter
function.
The sorter function will be called with two keys from the same map and should
return true
if the first argument precedes or is in the same place as the
second one.
Does not currently support structs and requires Jason
.
@spec format_ordered_to_iodata!(term(), key_sorter()) :: iodata()
Like format_ordered!/1
Equivalent to JSON.encode_to_iodata!/1
.