Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 mnesia 中有一个查询,它返回一个像这样的元组列表:
[{"str", 10}, {"str2", 20}]
我想将其转换为 json 使用jiffy,但似乎jiffy:encode/1做不到。有没有办法解决我的问题?!
jiffy
jiffy:encode/1
我不明白您的期望,但首先您应该提供正确的数据格式:
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}">>