JSON is a subset of the ECMAScript standard.
Douglas Crockford specified it in 2001 at json.org.
Jesse James Garrett proposed Ajax, and JSON suddenly became popular.
JSON is the intersection of modern programming languages. All modern languages have:
- simple values (Boolean, number, string)
- a sequence of values (array, vector, list)
- a collection of named values (object, record, struct, hash, property list)
Other data interchange formats try to be a union of all data types, which is a huge mess. JSON is very simple, and so eventually it became more popular with developers than XML.
JSON.parse became available in ES5 from 2009.
The JSON specification:
- requires strings to be quoted
- disallows comments
- allows e notation for numbers
- will not have any new versions: it's stable, forever
- Lisp's S-expressions from 1958
- Rebol
- JavaScript
- Python
- NewtonScript
- NeXT: OpenStep Property Lists
- XML, specifically how quickly it became popular
- HTML
XML's motto is: One tool to rule them all.
JSON's motto is: Use the right tool for the right job.
Here is the McKeeman form for JSON:
- element
- object
- array
- string
- number
- "true"
- "false"
- "null"
- '{' ws '}'
- '{' members '}'
- member
- member ',' members
- ws string ws ':' element
- '[' ws ']'
- '[' elements ']'
- element
- element ',' elements
- ws value ws
- '"' characters '"'
- ""
- character characters
- '0020' . '10FFFF' - '"' - ''
- '' escape
- '"'
- ''
- '/'
- 'b'
- 'f'
- 'n'
- 'r'
- 't'
- 'u' hex hex hex hex
- digit
- 'A' . 'F'
- 'a' . 'f'
- integer fraction exponent
- digit
- onenine digits
- '-' digit
- '-' onenine digits
- digit
- digit digits
- '0'
- onenine
- '1' . '9'
- ""
- '.' digits
- ""
- 'E' sign digits
- 'e' sign digits
- ""
- '+'
- '-'
- ""
- '0020' ws
- '000A' ws
- '000D' ws
- '0009' ws