Decode JSON with mochijson2 in Erlang
- by Jon Romero
I have a var that has some JSON data:
A = <<"{\"job\": {\"id\": \"1\"}}">>.
Using mochijson2, I decode the data:
Struct = mochijson2:decode(A).
And now I have this:
{struct,[{<<"job">>,{struct,[{<<"id">>,<<"1">>}]}}]}
I am trying to read (for example), "job" or "id".
I tried using struct.get_value but it doesn't seem to work.
Any ideas?