[erlang-questions] json to map

Bengt Kleberg bengt.kleberg@REDACTED
Tue Aug 25 14:21:24 CEST 2015


Greetings,

If you replace all
:
with
,

and add a final
.

you can use file:consult/1 to read the file directly.


bengt

On 08/25/2015 02:16 PM, Roelof Wobben wrote:
> Hello,
>
> As a challenge I need to convert a json file to a erlang map.
>
> So I have this file :
>
> {
>     "foo": {
>         "id": 1,
>         "username": "Foo Foo",
>         "first": "Foo",
>         "last": "Foo",
>         "password": "foo",
>         "email": "foo@REDACTED",
>         "scope": ["admin", "user"]
>     },
>     "bar": {
>         "id": 2,
>         "username": "Bar Head",
>         "first": "Bar",
>         "last": "Head",
>         "password": "bar",
>         "email": "bar@REDACTED",
>         "scope": ["user"]
>     }
> }
>
>
> as far as I can see it's a tuple of tuples.
> What are the steps to convert it.
>
> I do not need the code just some steps which point me to the right 
> direction.
>
> Roelof
>
>
> ---
> Dit e-mailbericht is gecontroleerd op virussen met Avast 
> antivirussoftware.
> https://www.avast.com/antivirus
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list