View Source euneus_decoder (euneus v0.3.0)

Decode JSON to Erlang terms.

Summary

Types

-type error_reason() ::
    unexpected_end_of_input |
    {unexpected_byte, binary(), position()} |
    {unexpected_sequence, binary(), position()}.
-type input() :: binary() | iolist().
-type normalize_fun(Input) :: fun((Input, options()) -> term()).
-type options() ::
    #{null_term => term(),
      normalize_key => normalize_fun(Input :: binary()),
      normalize_value => normalize_fun(Input :: binary()),
      normalize_array => normalize_fun(Input :: list()),
      normalize_object => normalize_fun(Input :: map())}.
-type position() :: non_neg_integer().
-type result() :: {ok, term()} | {error, error_reason()}.

Functions

-spec decode(Input, Opts) -> Result when Input :: input(), Opts :: options(), Result :: result().