Jaxon.Parser behaviour (Jaxon v2.0.7) View Source

Example

Call parse/1 get a list of parsed events:

Note that keys are treated as the same as strings

iex> Jaxon.Parser.parse("{\"jaxon\":\"rocks\",\"array\":[1,2]}")
{:ok, [
 :start_object,
 {:string, "jaxon"},
 :colon,
 {:string, "rocks"},
 :comma,
 {:string, "array"},
 :colon,
 :start_array,
 {:integer, 1},
 :comma,
 {:integer, 2},
 :end_array,
 :end_object
]}
iex> Jaxon.Parser.parse(~s(2, 3  true null "incomplete string))
{:incomplete, [
 {:integer, 2},
 :comma,
 {:integer, 3},
 {:boolean, true},
  nil,
], "\"incomplete string"}

Link to this section Summary

Functions

See Jaxon.Parsers.NifParser.parse/2.

Link to this section Types

Specs

parse_return() ::
  {:ok, [Jaxon.Event.t()]}
  | {:incomplete, [Jaxon.Event.t()], String.t()}
  | {:error, Jaxon.ParseError.t()}

Link to this section Functions

Link to this function

parse(events, opts \\ [])

View Source

Specs

parse(String.t(), Keyword.t()) :: parse_return()

See Jaxon.Parsers.NifParser.parse/2.

Link to this section Callbacks