Emdros's JSON implementation
JSON
JSON is a simple data interchange language. It is easy for humands to read
and write. It is also easy for machines to parse and generate.
JSON builds on three kinds of data structures:
- Objects: An object in JSON is an unordered set
of key/value pairs.
- Arrays: An array in JSON is an ordered list of
values.
- Values: A value in JSON is one of the
following kinds:
- null: A JSON value which is used to mean "no
value".
- true: A JSON value which is used to mean "the
Boolean value 'true'".
- false: A JSON value which is used to mean "the
Boolean value 'false'".
- string: A JSON value which denotes a string. It
is enclosed in "double quotes", and may contain "escape characters".
For a full list of escape characters, please see below.
- number: A JSON value which denotes a
number. In real JSON, these numbers can be both integers and
floating-point numbers. In the implementation present in
Emdros, they can only be the integers (positive and negative,
as well as 0). Thus, floating-point numbers cannot be
represented in the JSON implementation in Emdros.
- object: A JSON object. Note that this entails
that JSON objects may contain JSON objects, just as JSON arrays may
contain JSON objects.
- array: A JSON array. Note that this entails that
JSON arrays may contain JSON arrays, just as JSON objects may contain
JSON arrays.
Escape codes
In JSON, strings are surrounded by "double quotes". Inside the
double quotes, one may place "escape characters", which map to other
characters. The ones present in Emdros's JSON are:
- \": maps to "
- \\: maps to \
- \b: maps to "bell" (control character 0x07)
- \f: maps to "form feed" (control character 0x0c)
- \n: maps to "newline" (control character 0x0a)
- \r: maps to "carriage return" (control character 0x0d)
- \t: maps to "horizontal tab" (control character 0x09)
- \x[A-Fa-f0-9][A-Fa-f0-9]: Maps to the 8-bit
number expressed by the hexadecimal number after the \x. Note that
this is a departure from "real" JSON, where 8-bit characters are not
supported.
- \u[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]:
Maps to the 16-bit Unicode code point expressed by the hexadecimal
number after the \u.
More information
For more information about JSON, please visit:
http://www.json.org
|