Poison
Summary↑
decode!(iodata, options \\ []) | Decode JSON to a value, raises an exception on error |
decode(iodata, options \\ []) | Decode JSON to a value |
encode!(value, options \\ []) | Encode a value to JSON, raises an exception on error |
encode(value, options \\ []) | Encode a value to JSON |
encode_to_iodata!(value, options \\ []) | Encode a value to JSON as iodata, raises an exception on error |
encode_to_iodata(value, options \\ []) | Encode a value to JSON as iodata |
Functions
Specs:
- decode(iodata, Keyword.t) :: {:ok, Poison.Parser.t} | {:error, :invalid} | {:error, {:invalid, String.t}}
Decode JSON to a value.
iex> Poison.decode("[1,2,3]")
{:ok, [1, 2, 3]}
Specs:
- decode!(iodata, Keyword.t) :: Poison.Parser.t | no_return
Decode JSON to a value, raises an exception on error.
iex> Poison.decode!("[1,2,3]")
[1, 2, 3]
Specs:
- encode(Poison.Encoder.t, Keyword.t) :: {:ok, iodata} | {:ok, String.t} | {:error, {:invalid, any}}
Encode a value to JSON.
iex> Poison.encode([1, 2, 3])
{:ok, "[1,2,3]"}
Specs:
- encode!(Poison.Encoder.t, Keyword.t) :: iodata | no_return
Encode a value to JSON, raises an exception on error.
iex> Poison.encode!([1, 2, 3])
"[1,2,3]"
Specs:
- encode_to_iodata(Poison.Encoder.t, Keyword.t) :: {:ok, iodata} | {:error, {:invalid, any}}
Encode a value to JSON as iodata.
iex> Poison.encode_to_iodata([1, 2, 3])
{:ok, [91, "1", [44, "2", 44, "3"], 93]}
Specs:
- encode_to_iodata!(Poison.Encoder.t, Keyword.t) :: iodata | no_return
Encode a value to JSON as iodata, raises an exception on error.
iex> Poison.encode_to_iodata!([1, 2, 3])
[91, "1", [44, "2", 44, "3"], 93]