JSON (json v1.4.1) View Source
Provides a RFC 7159, ECMA 404, and JSONTestSuite compliant JSON Encoder / Decoder
Link to this section Summary
Functions
Converts a valid JSON string into an Elixir term
Converts a valid JSON string into an Elixir term, raises errors when something bad happens
Returns a JSON string representation of the Elixir term
Returns a JSON string representation of the Elixir term, raises errors when something bad happens
Link to this section Functions
Specs
Converts a valid JSON string into an Elixir term
Examples
iex> JSON.decode("{\"result\":\"this will be an Elixir result\"}")
{:ok, Enum.into([{"result", "this will be an Elixir result"}], Map.new)}
Specs
Converts a valid JSON string into an Elixir term, raises errors when something bad happens
Examples
iex> JSON.decode!("{\"result\":\"this will be an Elixir result\"}")
Enum.into([{"result", "this will be an Elixir result"}], Map.new)
Specs
Returns a JSON string representation of the Elixir term
Examples
iex> JSON.encode([result: "this will be a JSON result"])
{:ok, "{\"result\":\"this will be a JSON result\"}"}
Specs
Returns a JSON string representation of the Elixir term, raises errors when something bad happens
Examples
iex> JSON.encode!([result: "this will be a JSON result"])
"{\"result\":\"this will be a JSON result\"}"