json v1.0.3 JSON 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
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)}
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)
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\"}"}