Skip to content
Eric Pailleau edited this page Dec 30, 2017 · 4 revisions

Maps

Decoding

JSON decoding to Erlang map need the option {mode, map}.

1> {ok, A} = jason:decode_file("priv/ref1.json",[{mode, map}, {return, tuple}]).   
{ok,#{glossary => #{'GlossDiv' => #{'GlossList' => #{'GlossEntry' => #{'Abbrev' => "ISO 8879:1986",
              'Acronym' => "SGML",
              'GlossDef' => #{'GlossSeeAlso' => ["GML","XML"],
                para => "A meta-markup language, used to create markup languages such as DocBook."},
              'GlossSee' => "markup",
              'GlossTerm' => "Standard Generalized Markup Language",
              'ID' => "SGML",
              'SortAs' => "SGML"}},
          title => "S"},
        title => "example glossary"}}}
Clone this wiki locally