tags:

views:

293

answers:

4

I wanted to use YAML but there is not a single mature YAML library for Erlang. I know there are a few JSON libraries, but was wondering which is the most mature?

A: 

Trapexit offers a really cool search feature for Erlang projects.

Lookup for JSON there, you'll find almost 13 results. Check the dates of the latest revisions, the user rating, the project activity status.

UPDATE: I've just found a similar question n StackOverflow. Apparently, they are quite happy with the erlang-json-eep-parser parser.

Roberto Aloi
Yes, I looked here. which is your favorite?
Zubair
+8  A: 

Have a look at the one from mochiweb: http://code.google.com/p/mochiweb/source/browse/trunk/src/mochijson.erl

1> mochijson:decode("{\"Name\":\"Tom\",\"Age\":10}").   
{struct,[{"Name","Tom"},{"Age",10}]}
TP
Cool, taking a look now. Is this your preferred choice?
Zubair
Or mochijson2. Depends on your taste. The suggested one returns a record with strings; the '2' one returns no record and binaries.
Zed
A: 

I use json library provided by yaws.

Yogish Baliga
+1  A: 

My favourite is mochijson2. The API is straightforward, it's fast enough for me (I never actually bothered to benchmark it though, to be honest--I'm mostly en- and de-coding small packets), and I've been using it in a stable "production server" for a year now or so. Just remember to install mochinum as well, mochijson2 uses it to encode large numbers, if you miss it, and you'll try to encode a large number, it will throw an exception.

See also: mochijson2 examples (stackoverflow)

Amadiro