mochijson

Yet another JSON (RFC 4627) library for Erlang.

Yet another JSON (RFC 4627) library for Erlang.

DATA TYPES

binary_decoder_option() = {object_hook, function()}
binary_encoder_option() = {handler, function()}
bjson_array() = [bjson_term()]
bjson_number() = integer() | float()
bjson_object() = {struct, [{bjson_string(), bjson_term()}]}
bjson_string() = binary()
bjson_term() = bjson_string() | bjson_number() | bjson_array() | bjson_object()
decoder_option() = {input_encoding, encoding()} | {object_hook, function()}
encoder_option() = {input_encoding, encoding()} | {handler, function()}
encoding() = utf8 | unicode
iodata() = iolist() | binary()
iolist() = [char() | binary() | iolist()]
json_array() = {array, [json_term()]}
json_number() = integer() | float()
json_object() = {struct, [{json_string(), json_term()}]}
json_string() = atom | string() | binary()
json_term() = json_string() | json_number() | json_array() | json_object()

Functions


binary_decode(S::iolist()) -> bjson_term()

Decode the given iolist to Erlang terms, using lists for arrays and binaries for strings.

binary_decoder(Options::[binary_decoder_option()]) -> function()

Create a binary_decoder/1 with the given options.

binary_encode(Any::bjson_term()) -> iolist()

Encode the given as JSON to an iolist, using lists for arrays and binaries for strings.

binary_encoder(Options::[binary_encoder_option()]) -> function()

Create a binary_encoder/1 with the given options.

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