Module dmochijson2

Yet another JSON (RFC 4627) library for Erlang.

Copyright © 2007 Mochi Media, Inc.

Authors: Bob Ippolito (bob@mochimedia.com).

Description

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).

JSON terms are decoded as follows (javascript -> erlang): The encoder will accept the same format that the decoder will produce, but will also allow additional cases for leniency:

Data Types

encoder_option()

encoder_option() = handler_option() | utf8_option()

utf8_option()

utf8_option() = boolean()

Emit unicode as utf8 (default - false)

Function Index

decode/1Decode the given iodata to Erlang terms.
decode/2Decode the given iodata to Erlang terms using the given object format for decoding, where proplist returns JSON objects as [{binary(), json_term()}] proplists, eep18 returns JSON objects as {[binary(), json_term()]}, and struct returns them as-is.
decoder/1Create a decoder/1 with the given options.
encode/1Encode the given as JSON to an iodata.
encoder/1Create an encoder/1 with the given options.

Function Details

decode/1

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

Decode the given iodata to Erlang terms.

decode/2

decode(S::iodata(), Options::[{format, proplist | eep18 | struct}]) -> json_term()

Decode the given iodata to Erlang terms using the given object format for decoding, where proplist returns JSON objects as [{binary(), json_term()}] proplists, eep18 returns JSON objects as {[binary(), json_term()]}, and struct returns them as-is.

decoder/1

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

Create a decoder/1 with the given options.

encode/1

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

Encode the given as JSON to an iodata.

encoder/1

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

Create an encoder/1 with the given options.


Generated by EDoc