Module euneus

Function Index

decode/1Decodes a binary JSON into a term.
decode/2Decodes a binary JSON into a term.
decode_iodata/1Decodes an iodata JSON into a term.
decode_iodata/2Decodes an iodata JSON into a term.
decode_stream_continue/2Continue parsing a stream of bytes of a JSON value.
decode_stream_end/1Ends parsing a stream of bytes of a JSON value.
decode_stream_start/1Equivalent to decode_stream_start(JSON, #{}).
decode_stream_start/2Begin parsing a stream of bytes of a JSON value.
encode/1Encodes a term into a binary JSON.
encode/2Encodes a term into a binary JSON.
encode_to_iodata/1Encodes a term into an iodata JSON.
encode_to_iodata/2Encodes a term into an iodata JSON.
format/2Formats a binary JSON.
format_to_iodata/2Formats a binary JSON.
minify/1Minifies a binary JSON.
minify_to_iodata/1Minifies a binary JSON.

Function Details

decode/1

decode(JSON) -> term()

Decodes a binary JSON into a term.

Example:

  1> euneus:decode(<<"\"foo\"">>).
  <<"foo">>

decode/2

decode(JSON, Options) -> term()

Decodes a binary JSON into a term.

Example:

  1> euneus:decode(<<"\"foo\"">>, #{}).
  <<"foo">>

decode_iodata/1

decode_iodata(JSON) -> term()

Decodes an iodata JSON into a term.

Example:

  1> euneus:decode_iodata([$", <<"foo">>, $"]).
  <<"foo">>

decode_iodata/2

decode_iodata(JSON, Options) -> term()

Decodes an iodata JSON into a term.

Example:

  1> euneus:decode_iodata([$", <<"foo">>, $"], #{}).
  <<"foo">>

decode_stream_continue/2

decode_stream_continue(JSON, State) -> Result

Equivalent to euneus_decoder:stream_continue(JSON, State).

Continue parsing a stream of bytes of a JSON value.

Example:

  1> begin
  .. {continue, State} = euneus:decode_stream_start(<<"{\"foo\":">>),
  .. euneus:decode_stream_continue(<<"1}">>, State)
  .. end.
  {end_of_input,#{<<"foo">> => 1}}

decode_stream_end/1

decode_stream_end(State) -> Result

Equivalent to euneus_decoder:stream_continue(end_of_input, State).

Ends parsing a stream of bytes of a JSON value.

Example:

  1> begin
  .. {continue, State} = euneus:decode_stream_start(<<"123">>),
  .. euneus:decode_stream_end(State)
  .. end.
  {end_of_input,123}

decode_stream_start/1

decode_stream_start(JSON) -> Result

Equivalent to decode_stream_start(JSON, #{}).

decode_stream_start/2

decode_stream_start(JSON, Options) -> Result

Equivalent to euneus_decoder:stream_start(JSON, Options).

Begin parsing a stream of bytes of a JSON value.

encode/1

encode(Term) -> binary()

Encodes a term into a binary JSON.

Example:

  1> euneus:encode(foo).
  <<"\"foo\"">>

encode/2

encode(Term, Options) -> binary()

Encodes a term into a binary JSON.

Example:

  1> euneus:encode(foo, #{}).
  <<"\"foo\"">>

encode_to_iodata/1

encode_to_iodata(Term) -> iodata()

Encodes a term into an iodata JSON.

Example:

  1> euneus:encode_to_iodata(foo).
  [$", <<"foo">>, $"]

encode_to_iodata/2

encode_to_iodata(Term, Options) -> iodata()

Encodes a term into an iodata JSON.

Example:

  1> euneus:encode_to_iodata(foo, #{}).
  [$", <<"foo">>, $"]

format/2

format(JSON, Options) -> binary()

Equivalent to iolist_to_binary(format(JSON, Options)).

Formats a binary JSON.

Example:

  1> Opts = #{
  ..     indent_type => tabs,
  ..     indent_width => 1,
  ..     spaced_values => true,
  ..     crlf => n
  .. }.
  #{indent_type => tabs,indent_width => 1,spaced_values => true, crlf => n}
  2> euneus:format(<<" \n{\"foo\"  :  [ true  , \n null ] \n  }  ">>, Opts).
  <<"{\n\t\"foo\": [\n\t\ttrue,\n\t\tnull\n\t]\n}">>

format_to_iodata/2

format_to_iodata(JSON, Options) -> iodata()

Formats a binary JSON.

minify/1

minify(JSON) -> binary()

Equivalent to iolist_to_binary(minify_to_iodata(JSON)).

Minifies a binary JSON.

Example:

  1> euneus:minify(<<" \n{\"foo\"  :  [ true  , \n null ] \n  }  ">>).
  <<"{\"foo\":[true,null]}">>

minify_to_iodata/1

minify_to_iodata(JSON) -> iodata()

Minifies a binary JSON.


Generated by EDoc