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
Post a Comment