Copyright © 2007 Mochi Media, Inc.
Authors: Bob Ippolito (bob@mochimedia.com).
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):encoder_option() = handler_option() | utf8_option()
utf8_option() = boolean()
Emit unicode as utf8 (default - false)
decode/1 | Decode the given iodata to Erlang terms. |
decode/2 | 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 | Create a decoder/1 with the given options. |
encode/1 | Encode the given as JSON to an iodata. |
encoder/1 | Create an encoder/1 with the given options. |
decode(S::iodata()) -> json_term()
Decode the given iodata to Erlang terms.
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(Options::[decoder_option()]) -> function()
Create a decoder/1 with the given options.
encode(Any::json_term()) -> iodata()
Encode the given as JSON to an iodata.
encoder(Options::[encoder_option()]) -> function()
Create an encoder/1 with the given options.
Generated by EDoc