View Source euneus (euneus v2.0.0)

Summary

Functions

Decodes a binary JSON into a term.

Decodes a binary JSON into a term.

Decodes an iodata JSON into a term.

Decodes an iodata JSON into a term.

Encodes a term into a binary JSON.

Encodes a term into a binary JSON.

Encodes a term into an iodata JSON.

Encodes a term into an iodata JSON.

Formats a binary JSON.

Minifies a binary JSON.

Functions

-spec decode(binary()) -> term().

Decodes a binary JSON into a term.

Example:

  1> euneus:decode(<<"\"foo\"">>).
  <<"foo">>
-spec decode(binary(), euneus_decoder:options()) -> term().

Decodes a binary JSON into a term.

Example:

  1> euneus:decode(<<"\"foo\"">>, #{}).
  <<"foo">>
-spec decode_iodata(iodata()) -> term().

Decodes an iodata JSON into a term.

Example:

  1> euneus:decode_iodata([$", <<"foo">>, $"]).
  <<"foo">>
Link to this function

decode_iodata(JSON, Opts)

View Source
-spec decode_iodata(iodata(), euneus_decoder:options()) -> term().

Decodes an iodata JSON into a term.

Example:

  1> euneus:decode_iodata([$", <<"foo">>, $"], #{}).
  <<"foo">>
-spec encode(term()) -> binary().

Encodes a term into a binary JSON.

Example:

  1> euneus:encode(foo).
  <<"\"foo\"">>
-spec encode(term(), euneus_encoder:options()) -> binary().

Encodes a term into a binary JSON.

Example:

  1> euneus:encode(foo, #{}).
  <<"\"foo\"">>
-spec encode_iodata(term()) -> iodata().

Encodes a term into an iodata JSON.

Example:

  1> euneus:encode_iodata(foo).
  [$", <<"foo">>, $"]
Link to this function

encode_iodata(Term, Opts)

View Source
-spec encode_iodata(term(), euneus_encoder:options()) -> iodata().

Encodes a term into an iodata JSON.

Example:

  1> euneus:encode_iodata(foo, #{}).
  [$", <<"foo">>, $"]
-spec format(binary(), euneus_formatter:options()) -> binary().

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}">>
-spec minify(binary()) -> binary().

Minifies a binary JSON.

Example:

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