JSON

What is JSON: JavaScript Object Notation?

JSON - abbreviation for JavaScript Object Notation - is a data interchange and file format that:

  • is language independent although being based to some extent upon JavaScript object literal notation,

  • is humanly readable,

  • conveys data within the constraints of the JSON allowed value types,

  • was first specified in the early 2000s but standardized in 2013,

  • official MIME type is application/json.

Value Types

There are the following values in JSON:

  • String - a sequence of zero or more characters delimited with double quotes (e.g. "Roach"),

  • Number - a signed double-precision float - written without quotes (e.g. 42),

  • Boolean - true / false,

  • Array - [ ... ] - an ordered list of other allowed JSON types,

  • Object - { ... } - a collection (an object structure) of name-value pairs in which names are strings delimited with double quotes and types are allowed JSON types,

  • null.

{
  "geraltsHorse": "Roach",
  "theAnswerToTheUniverse": 42,
  "isFriday": true,
  "birds": ["eagle", "stork", "hawk"],
  "ridersAndHorses": {
    "geraltsHorse": "Roach",
    "cirisHorse": "Kelpie",
    "alexandersHorse": "Bucephalus"
  },
  "availableTime": null
}

Valid JSONs

A valid JSON is not only name-value pair collection contained within an object structure ({ ... }) but all other value types even when not enclosed within such a structure. Therefore a standalone array, a standalone string or any other standalone value type is a valid JSON.