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

decode(iodata, options \\ [])

Specs:

Decode JSON to a value.

iex> Poison.decode("[1,2,3]")
{:ok, [1, 2, 3]}
decode!(iodata, options \\ [])

Specs:

Decode JSON to a value, raises an exception on error.

iex> Poison.decode!("[1,2,3]")
[1, 2, 3]
encode(value, options \\ [])

Specs:

Encode a value to JSON.

iex> Poison.encode([1, 2, 3])
{:ok, "[1,2,3]"}
encode!(value, options \\ [])

Specs:

Encode a value to JSON, raises an exception on error.

iex> Poison.encode!([1, 2, 3])
"[1,2,3]"
encode_to_iodata(value, options \\ [])

Specs:

Encode a value to JSON as iodata.

iex> Poison.encode_to_iodata([1, 2, 3])
{:ok, [91, "1", [44, "2", 44, "3"], 93]}
encode_to_iodata!(value, options \\ [])

Specs:

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]