Reputation: 755
I have a query in mnesia that returns a list of tuples like this:
[{"str", 10}, {"str2", 20}]
I want to convert it to json using jiffy
but it seems jiffy:encode/1
can't do it. Is there anyway to solve my problem?!
Upvotes: 2
Views: 870
Reputation: 26121
I don't understand what you expect but first you should provide right data format:
1> L = [{"str", 10}, {"str2", 20}].
[{"str",10},{"str2",20}]
2> jiffy:encode({[{list_to_binary(K), V} || {K, V} <- L]}).
<<"{\"str\":10,\"str2\":20}">>
Upvotes: 5