-
Notifications
You must be signed in to change notification settings - Fork 4
Structs
Eric Pailleau edited this page Dec 30, 2017
·
7 revisions
JSON decoding to Erlang binary structure is the default if no mode
given, but can use the option {mode, struct}
.
Note : it is only a convention. Binary struct is returned by default if mode
value is not map
,proplist
or record
.
So {mode, whatever}
will return binary struct as well.
1> {ok, A} = jason:decode_file("priv/ref1.json",[{mode, struct}, {return, tuple}]).
{ok,[{<<"glossary">>,
[{<<"title">>,<<"example glossary">>},
{<<"GlossDiv">>,
[{<<"title">>,<<"S">>},
{<<"GlossList">>,
[{<<"GlossEntry">>,
[{<<"ID">>,<<"SGML">>},
{<<"SortAs">>,<<"SGML">>},
{<<"GlossTerm">>,<<"Standard Generalized Markup Lang"...>>},
{<<"Acronym">>,<<"SGML">>},
{<<"Abbrev">>,<<"ISO 8879:1986">>},
{<<"GlossDef">>,
[{<<"para">>,<<"A meta-m"...>>},
{<<"GlossSee"...>>,[<<...>>|...]}]},
{<<"GlossSee">>,<<"markup">>}]}]}]}]}]}