JSON Quick Reference¶
Basics¶
JSON stands for JavaScript Object Notation. There are 3 types of data in JSON:
- JSON value
- JSON object
- JSON array
A JSON value can be one of the following 6 types:
- Number: double-precision floating-point value
- String: double-quoted string
- Boolean: true or false
- JSON object
- JSON array
- null
A JSON object is:
- An unordered set of name/value pairs, beginning with left curly brace (
{
) and ending with right curly brace (}
). - The name/value pair consists of a name, followed by colon (
:
), followed by a value. - The name has to be a String (i.e., double-quoted string).
- The value has to be a JSON value.
- Each name/value pair is separated by a comma (
,
).
Example of JSON object:
{
"projectName": "MyProject",
"Version": 1.0
}
Note
The trailing comma (comma after the last name/value pair) is a syntax error per the JSON spec
A JSON array is:
- An ordered collection of JSON values, beginning with left square brace (
[
) and ending with right square brace (]
). - Each value is separated by a comma (
,
)
Example of JSON array:
[
1.0,
"2.0",
{
"projectName": "MyProject"
}
]