[erlang-questions] Json for Erlang?

Jim Larson <>
Sun Dec 23 23:48:16 CET 2007


In message <> you write:
>Looking for a JSon implementation for Erlang, I have found a post in 
>this list about a release of a similar code in January 2006.
>
>This release Google says it should be hosted in the site 
>Erlang-Projects, but trying to access it I consistently get Bad Gateway...
>
>Any hint about how to get that code?

I've been getting the bad gateway error for the last week too.
There's a copy available at http://paste.lisp.org/display/48077
I'll also put up a copy on my home page soon.

The yaws version is derived from our original version, with
modifications to the Erlang encoding.

The lshift version is of independent heritage.  It requires a full
JSON term to be available, whereas the above versions can parse
json terms across several chunks of input, for use in the middle-man
pattern if there's no other framing available.  The lshift version
might be faster - I've never done the experiment.

Here are the encodings that the various versions use:

JSON		json v1		json v2		rfc4627
		(A2Z)		(Yaws)		(lshift)
- -----		-----		-----		-----

number		number		number		number
string		string (list)	string (list)	binary
array		tuple		tagged list	list
object		tagged proplist	tagged proplist	tagged proplist
bool, null	atoms		atoms		atoms

They're all roughly equivalent, so choose the one with the best
match for the types you'll be encoding/decoding.  It's super-handy
if you pick an encoding that doesn't require further translation
from an "external" to an "internal" Erlang data structure.

And if none of the above fit your need, it's quite easy to roll
your own.

Jim Larson



More information about the erlang-questions mailing list