Jiffex v0.2.0 Jiffex
Plain wrapper around :jiffy library to make it more usable in elixir projects.
Link to this section Summary
Functions
Decodes json
, in case of dicts uses Map
s.
Returns {:ok, result}
or {:error, reason}
See decode/1
for details, works the similar way,
but returns result
and raises in case of error
Encodes elixir term
to json
Returns {:ok, result}
or {:error, reason}
See encode/1
for details, works the similar way,
but returns result
and raises in case of error
Link to this section Functions
decode(json)
Decodes json
, in case of dicts uses Map
s.
Returns {:ok, result}
or {:error, reason}
iex> Jiffex.decode("{\"a\": 1, \"b\": null}") {:ok, %{"a" => 1, "b" => nil}}
iex> Jiffex.decode("something wrong here") {:error, {1, :invalid_json}}
decode!(json)
See decode/1
for details, works the similar way,
but returns result
and raises in case of error.
encode(term)
Encodes elixir term
to json
Returns {:ok, result}
or {:error, reason}
iex> Jiffex.encode(%{"a" => 1, "b" => nil}) {:ok, "{\"b\":null,\"a\":1}"}
iex> Jiffex.encode({}) {:error, {:invalid_ejson, {}}}
encode!(term)
See encode/1
for details, works the similar way,
but returns result
and raises in case of error.