Functions for JSON to Erlang data conversion.
For most purposes, these functions are not called by code outside of
this library: Erlang client and Erlang server application code usually
have no need to use these functions.
== Links
- http://www.erlang-projects.org/Public/news/ejson/view
- http://www.erlang.org/eeps/eep-0018.html
- http://www.erlang.org/ml-archive/erlang-questions/200511/msg00193.html
- http://www.ietf.org/rfc/rfc4627.txt
- http://www.json.org/
- http://www.lshift.net/blog/2007/02/17/json-and-json-rpc-for-erlang
- http://www.json.com/json-schema-proposal/
== JSON Basic Data Types
------
object
{}
{ members }
members
pair
pair, members
pair
string : value
array
[]
[ elements ]
elements
value
value, elements
value
string
number
object
true (atom)
false (atom)
null (atom)
------
== Mapping: JSON -> Erlang Terms, using mochiweb
------
json::object() = {struct, [json::pair()]}
json::pair() = {string(), json::value()}
string() = [byte()]
byte() = integer()
json::array() = [json::value()]
json::value() = json::object() | json::array() | json::number() | json::string() | json::true() | json::false() | json::null()
json::number() = integer() | float()
json::string() = binary()
json::true() = true
json::false() = false
json::null() = null
------
== Mapping: UBF -> Erlang Terms
------
ubf::tuple() = tuple()
ubf::list() = list()
ubf::number = integer() | float()
ubf::string() = {\'$S\', [integer()]}
ubf::proplist() = {\'$P\', [{term(), term()}]}
ubf::binary() = binary()
ubf::true() = true
ubf::false() = false
ubf::undefined() = undefined
ubf::atom() = atom()
ubf::record() = record()
------
== Mapping: UBF value -> JSON value
------
ubf::tuple() = {struct, [{<<"$T">>, ubf::list()}]}
ubf::list() = [value()]
ubf::number() = integer() | float()
ubf::string() = {struct, [{<<"$S">>, binary()}]}
ubf::proplist() = {struct, [{binary(), value()}]}
ubf::binary() = binary()
ubf::true() = true
ubf::false() = false
ubf::undefined() = null
ubf::atom() = {struct, [{<<"$A">>, atomname()}]}
atomname() = binary() % a.k.a. list_to_binary(atom_to_list()) for the actual atom
ubf::record() = {struct, [{<<"$R">>, recordname()}] ++ [recordpair()]}
recordname() = binary() % a.k.a. list_to_binary(atom_to_list()) for the record\'s name
recordpair() = {recordkey(), value()}
recordkey() = binary() % a.k.a. list_to_binary(atom_to_list()) for the record key\'s name
value() = ubf::tuple() | ubf::list() | ubf::number() | ubf::string() | ubf::binary() | ubf::true() | ubf::false() | ubf::undefined() | ubf::atom() | ubf::record()
------
.
Behaviours: contract_proto
.
atom_to_binary(X) -> any()
binary_to_atom(X) -> any()
binary_to_existing_atom(X) -> any()
contract_records() -> any()
decode(X) -> any()
decode(X, Mod) -> any()
decode(X, Mod, State) -> any()
decode_init() -> any()
decode_init(Safe) -> any()
decode_init(Safe, Binary) -> any()
do_decode(X, Mod) -> any()
do_decode(X, Mod, Safe) -> any()
do_encode(X, Mod) -> any()
encode(X) -> any()
encode(X, Mod) -> any()
proto_driver() -> any()
proto_packet_type() -> any()
proto_vsn() -> any()