diff --git a/src/jsx.erl b/src/jsx.erl index ff1bc09..79682b9 100644 --- a/src/jsx.erl +++ b/src/jsx.erl @@ -60,8 +60,11 @@ format(Source) -> format(Source, []). format(Source, Opts) -> jsx_to_json:format(Source, Opts). --spec to_term(Source::binary()) -> any(). --spec to_term(Source::binary(), Opts::jsx_to_term:opts()) -> any(). +-spec to_term(Source::binary()) -> + list({binary(), any()}). +-spec to_term(Source::binary(), Opts::jsx_to_term:opts()) -> + list({binary(), any()}). + to_term(Source) -> to_term(Source, []). @@ -258,4 +261,4 @@ incremental_decode_loop({incomplete, More}, <>) -> incremental_decode_loop(More(C), Rest). --endif. \ No newline at end of file +-endif. diff --git a/src/jsx_to_term.erl b/src/jsx_to_term.erl index b5b73bc..86e9882 100644 --- a/src/jsx_to_term.erl +++ b/src/jsx_to_term.erl @@ -34,7 +34,8 @@ -type opts() :: list(). --spec to_term(Source::(binary() | list()), Opts::opts()) -> binary(). +-spec to_term(Source::(binary() | list()), Opts::opts()) -> + list({binary(), any()}). to_term(Source, Opts) when is_list(Opts) -> (jsx:decoder(?MODULE, Opts, jsx_utils:extract_opts(Opts)))(Source). @@ -173,4 +174,4 @@ naked_test_() -> {"naked string", ?_assertEqual(to_term(<<"\"string\"">>, []), <<"string">>)} ]. --endif. \ No newline at end of file +-endif.