JSON and JSON-RPC for Erlang
Downloading the code:
- you can browse the code here on github
- a tarball is available here (note: this is dynamically generated from the HEAD revision in the git repository)
- the git repository holding the code can be retrieved with the command
The JSON codec uses a data type mapping suggested by Joe Armstrong, where strings map to binaries and arrays map to lists.
Coincidentally, on the very same day I started writing my JSON codec, Eric Merritt released his new JSON codec, Ktuo. If I’d seen that, I probably wouldn’t have started writing my own. At the time, the only other implementation I knew of was the json.erl included with yaws, which uses an awkward (to me) encoding and was, at the time I was using it, a bit buggy (decoding “” returned an incorrect value – it seems to have been fixed somewhere between yaws 1.64 and 1.68). To an extent, Eric’s rationale for a new JSON codec applies to mine, too, and my other excuse is that the data type mapping where strings become Erlang binaries is much more useful to my application. Your mileage may vary!