poison v3.0.0 Poison
Summary
Functions
Decode JSON to a value
Decode JSON to a value, raises an exception on error
Encode a value to JSON
Encode a value to JSON, raises an exception on error
Encode a value to JSON as iodata
Encode a value to JSON as iodata, raises an exception on error
Functions
decode(iodata, options \\ [])
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]}
Decode JSON to a value, raises an exception on error.
iex> Poison.decode!("[1,2,3]")
[1, 2, 3]
encode(value, options \\ [])
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]"}
Encode a value to JSON, raises an exception on error.
iex> Poison.encode!([1, 2, 3])
"[1,2,3]"
encode_to_iodata(value, options \\ [])
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]}
encode_to_iodata!(value, options \\ [])
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]