View Source thoas (thoas v1.1.0)

Link to this section Summary

Link to this section Types

-type decode_error() ::
    unexpected_end_of_input |
    {unexpected_byte, binary(), integer()} |
    {unexpected_sequence, binary(), integer()}.
-type decode_options() :: #{strings => reference | copy}.
-type encode_options() :: #{escape => json | unicode | html | javascript}.
-type input_term() ::
    integer() |
    float() |
    binary() |
    atom() |
    calendar:date_time() |
    calendar:date() |
    [input_term()] |
    [{binary() | atom(), input_term()}] |
    #{binary() | atom() => input_term()}.
-type json_term() ::
    integer() | float() | binary() | boolean() | null | [json_term()] | #{binary() => json_term()}.

Link to this section Functions

-spec decode(iodata()) -> {ok, json_term()} | {error, decode_error()}.
-spec decode(iodata(), decode_options()) -> {ok, json_term()} | {error, decode_error()}.
-spec encode(input_term()) -> binary().
-spec encode(input_term(), encode_options()) -> binary().
-spec encode_to_iodata(input_term()) -> iodata().
Link to this function

encode_to_iodata(Input, Options)

View Source
-spec encode_to_iodata(input_term(), encode_options()) -> iodata().