By Xah Lee. Date: . Last updated: .

JSON is the value of the property key "JSON" of the global object. [JS: the Global Object]

console.log( window["JSON"] === JSON ); // true


Type of JSON is object.

[see JS: Value Types]

// type of JSON
console.log ( typeof JSON === "object" ); // true
console.log ( Object.prototype.toString.call( JSON ) === "[object JSON]" ) // true


Parent of JSON is Object.prototype. [see JS: Prototype and Inheritance]

// parent of JSON
console.log ( Object.getPrototypeOf ( JSON ) === Object.prototype ); // true


Purpose of JSON is as a namespace to hold functions, for working with the JSON data interchange format.

JSON is a static object.

JSON is not a function. You cannot call it, nor with new.

What's JSON Data Interchange Format?

JSON is a data interchange format.

JSON is a more strict syntax of nested JavaScript object or array. Used to pass data to the web browser, or exchange data with other language, API.

For example, here's a JSON:

  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true,
  "age": 25,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021-3100"
  "phoneNumbers": [
      "type": "home",
      "number": "212 555-1234"
      "type": "office",
      "number": "646 555-4567"
  "children": [],
  "spouse": null

More about JSON syntax can be found here. http://www.json.org/

JavaScript Syntax vs JSON Syntax

JSON syntax is more strict than JavaScript syntax. For example:



ECMAScript 2015 §Structured Data#sec-json-object

Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog