Jaxon v2.0.2 Jaxon View Source

Main Jaxon module.

Link to this section Summary

Functions

Decode a string.

Decode a string, throws if there's an error.

Link to this section Types

Link to this type

json_term()

View Source
json_term() ::
  nil
  | true
  | false
  | list()
  | float()
  | integer()
  | String.t()
  | map()
  | [json_term()]

Link to this section Functions

Link to this function

decode(binary)

View Source
decode(String.t()) ::
  {:ok, Jaxon.json_term()}
  | {:error,
     %Jaxon.ParseError{
       __exception__: term(),
       expected: term(),
       message: term(),
       unexpected: term()
     }}

Decode a string.

iex> Jaxon.decode(~s({"jaxon":"rocks","array":[1,2]}))
{:ok, %{"array" => [1, 2], "jaxon" => "rocks"}}

Decode a string, throws if there's an error.

iex(1)> Jaxon.decode!(~s({"jaxon":"rocks","array":[1,2]}))
%{"array" => [1, 2], "jaxon" => "rocks"}