[erlang-questions] How to access a Map returned by jiffy:decode()

Robert Raschke rtrlists@REDACTED
Sat Jul 25 15:28:36 CEST 2015


That's not a map. It's a tuple of one element, which is a list of
two-tuples ({key, value}). Such a list is often called a proplist.

You could get your results like this:
{Tx} = jiffy:decode...
proplists:get_value(<<"foo">>, Tx)

Hth,
Robby
On Jul 25, 2015 2:02 PM, "avinash D'silva" <evnix.com@REDACTED> wrote:

> I have the following code.
>  Tx=jiffy:decode(<<"{\"foo\": \"bar\",\"key\": \"val\"}">>).
>
> where Tx is:
> {[{<<"foo">>,<<"bar">>},{<<"key">>,<<"val">>}]}
>
> I tried the following:
>
> maps:get("foo",Tx).
> ** exception error:
> {badmap,{[{<<"foo">>,<<"bar">>},{<<"key">>,<<"val">>}]}}
>      in function  maps:get/2
>         called as maps:get("foo",
>                            {[{<<"foo">>,<<"bar">>},{<<"key">>,<<"val">>}]})
>
> Any Idea on what I am doing wrong? any possible solutions?
> I Couldn't find any documentation to access this type of map.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150725/a6863826/attachment.htm>


More information about the erlang-questions mailing list