mochijson2

Yet another JSON (RFC 4627) library for Erlang.

Yet another JSON (RFC 4627) library for Erlang. mochijson2 works with binaries as strings, arrays as lists (without an {array, _}) wrapper and it only knows how to decode UTF-8 (and ASCII).

DATA TYPES

encoder_option() = handler_option() | utf8_option()
iodata() = iolist() | binary()
iolist() = [char() | binary() | iolist()]
json_array() = [json_term()]
json_iolist() = {json, iolist()}
json_number() = integer() | float()
json_object() = {struct, [{json_string(), json_term()}]}
json_string() = atom | binary()
json_term() = json_string() | json_number() | json_array() | json_object() | json_iolist()
utf8_option() = boolean()

Emit unicode as utf8 (default - false)

Functions


decode(S::iolist()) -> json_term()

Decode the given iolist to Erlang terms.

decoder(Options::[decoder_option()]) -> function()

Create a decoder/1 with the given options.

encode(Any::json_term()) -> iolist()

Encode the given as JSON to an iolist.

encoder(Options::[encoder_option()]) -> function()

Create an encoder/1 with the given options.

Bob Ippolito bob@mochimedia.com
View Functions