Skip to content

JSON Quick Reference

Basics

JSON stands for JavaScript Object Notation. There are 3 types of data in JSON:

  1. JSON value
  2. JSON object
  3. JSON array

A JSON value can be one of the following 6 types:

  1. Number: double-precision floating-point value
  2. String: double-quoted string
  3. Boolean: true or false
  4. JSON object
  5. JSON array
  6. 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"
    }
]

Reference