No description
Find a file
2011-11-30 19:08:38 -08:00
include refactors out extraction of parser opts, generalizes use of specific parsers by processors 2011-11-29 19:39:01 -08:00
src removes loose_unicode opt from erlang -> json conversion 2011-11-30 19:08:38 -08:00
test/cases strings returned as binaries 2011-10-28 06:31:40 -07:00
.gitignore Ignoring compiled files 2011-05-09 15:34:51 -03:00
LICENSE and the license 2010-05-31 21:00:16 -07:00
makefile adds makefile 2011-11-29 20:05:49 -08:00
README.markdown fix for lists in README 2011-11-29 20:29:49 -08:00
rebar updated rebar to latest 2010-09-22 23:04:25 -07:00
rebar.config rebar config changes 2011-08-03 00:46:33 -07:00

jsx (v0.10.0)

a sane json implementation for erlang

quickstart

make or ./rebar compile

jsx:json_to_term/1,2 takes a utf8 encoded (binary) json text and produces a term as detailed below

jsx:term_to_json/1,2 takes a term conforming to the mapping detailed below and produces a utf8 encoded (binary) json text

options for either are:

* `loose_unicode`
* `explicit_end`
* `escape_forward_slash`

use loose_unicode to replace invalid utf8 sequences with u+FFFD instead of throwing an error

use explicit_end when parsing binary streams with indeterminate ends, like naked integers or json values with trailing whitespace

use escape_forward_slash to escape forward slashes, which is required to produce microsoft's silly date format

jsx:format/1,2 takes a utf8 encoded (binary) json text and produces the same, reformatted.

options are:

* {`space`, N}
* {`indent`, N}

the opt space will insert N spaces after every colon and comma, indent will insert a newline after every comma and N preceding spaces for every level of indent

erlang to json mapping

json erlang
true, false and null the atoms true, false and null
Number integers if possible, floats if not
String (also Key) utf8 encoded binaries
Array [] or [Value, ...]
Object [{}] or [{Key, Value}, ...]

license

jsx is copyright alisdair sullivan (alisdairsullivan@yahoo.ca) and released under the MIT license