How to read a key value after decoding json in erlang -


here short query

in erlang parsed json using

ccode = jiffy:decode(<<"{\"foo\": \"bar\"}">>). 

it returns

{[{<<"foo">>,<<"bar">>}]} 

now target value of 'foo' , should return 'bar'

any appreciated.

you can extract list of attributes of json object using pattern matching , find value key in resulting list:

{attrs} = jiffy:decode(<<"{\"foo\": \"bar\"}">>), foovalue = proplists:get_value(<<"foo">>, attrs). 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -