I have a var that has some JSON data:
A = <<\"{\\\"job\\\": {\\\"id\\\": \\\"1\\\"}}\">>.
Using mochijson2, I decode the data:
Here is another method of accessing the data. Uses records syntax for ease of use.
-record(struct, {lst=[]}).
A = <<"{\"job\": {\"id\": \"1\"}}">>,
Struct = mochijson2:decode(A),
Job = proplists:get_value(<<"job">>, Struct#struct.lst),
Id = proplists:get_value(<<"id">>, Job#struct.lst),
Does exactly the same thing as the answer using records instead. Just another option when using mochijson2. I personally like this syntax better.