diff --git a/src/jsx.erl b/src/jsx.erl index b903261..9820070 100644 --- a/src/jsx.erl +++ b/src/jsx.erl @@ -60,10 +60,22 @@ format(Source) -> format(Source, []). format(Source, Opts) -> jsx_to_json:format(Source, Opts). --spec to_term(Source::binary()) -> - list({binary(), any()}). --spec to_term(Source::binary(), Opts::jsx_to_term:opts()) -> - list({binary(), any()}). +-spec to_term(Source::binary()) -> list({binary(), any()}) + | list(any()) + | true + | false + | null + | integer() + | float() + | binary(). +-spec to_term(Source::binary(), Opts::jsx_to_term:opts()) -> list({binary(), any()}) + | list(any()) + | true + | false + | null + | integer() + | float() + | binary(). to_term(Source) -> to_term(Source, []). diff --git a/src/jsx_to_term.erl b/src/jsx_to_term.erl index 582a9af..b5c3b44 100644 --- a/src/jsx_to_term.erl +++ b/src/jsx_to_term.erl @@ -34,8 +34,14 @@ -type opts() :: list(). --spec to_term(Source::(binary() | list()), Opts::opts()) -> - list({binary(), any()}). +-spec to_term(Source::binary(), Opts::opts()) -> list({binary(), any()}) + | list(any()) + | true + | false + | null + | integer() + | float() + | binary(). to_term(Source, Opts) when is_list(Opts) -> (jsx:decoder(?MODULE, Opts, jsx_utils:extract_opts(Opts)))(Source).