Module js_mochijson2

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

Data Types

encoder_option()

encoder_option() = handler_option() | utf8_option()

json_array()

json_array() = [json_term()]

json_iolist()

json_iolist() = {json, iolist()}

json_number()

json_number() = integer() | float()

json_object()

json_object() = {struct, [{json_string(), json_term()}]}

json_string()

json_string() = atom | binary()

json_term()

json_term() = json_string() | json_number() | json_array() | json_object() | json_iolist()

utf8_option()

utf8_option() = boolean()

Emit unicode as utf8 (default - false)

Function Index

decode/1Decode the given iolist to Erlang terms.
decoder/1Create a decoder/1 with the given options.
encode/1Encode the given as JSON to an iolist.
encoder/1Create an encoder/1 with the given options.

Function Details

decode/1

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

Decode the given iolist to Erlang terms.

decoder/1

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

Create a decoder/1 with the given options.

encode/1

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

Encode the given as JSON to an iolist.

encoder/1

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

Create an encoder/1 with the given options.


Generated by EDoc, Mar 14 2025, 20:38:31.