apns_mochijson2

JSON (RFC 4627) library for Erlang taken from couchbeam.

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

Types


decoder_option() = term()

encoder_option() = term() | {utf8, boolean()}

json_array() = [json_term()]

json_boolean() = boolean()

json_null() = null

json_number() = integer() | float()

json_object() = {[json_property()]}

json_property() = {json_string(), json_term()}

json_string() = atom() | binary()

json_term() = json_string()
                    | json_number()
                    | json_array()
                    | json_object()
                    | json_null()
                    | json_boolean()

Functions


encoder(Options::[encoder_option()]) -> (term()) -> iolist()

Create an encoder/1 with the given options.

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

Encode the given as JSON to an iolist.

decoder(Options::[decoder_option()]) -> (iolist()) -> json_term()

Create a decoder/1 with the given options.

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

Decode the given iolist to Erlang terms.

get_value(Key::list() | binary(), JsonObj::json_object()) -> term()

Returns the value of a simple key/value property in json object.

get_value(Key::list() | binary(), JsonObj::json_object(), Default::term()) -> term()

Returns the value of a simple key/value property in json object function from erlang_couchdb

Bob Ippolito bob@mochimedia.com