2.4.14.1.1 The JSON Lexical Grammar

JSON is similar to ECMAScript source text in that it consists of a sequence of characters conforming to the rules of SourceCharacter. The JSON Lexical Grammar defines the tokens that make up a JSON text similar to the manner that the ECMAScript lexical grammar defines the tokens of an ECMAScript source test. The JSON Lexical grammar recognizes only the white space character specified by the production JSONWhiteSpace. The JSON lexical grammar shares some productions with the ECMAScript lexical grammar. All nonterminal symbols of the grammar that do not begin with the characters "JSON" are defined by productions of the ECMAScript lexical grammar.

Syntax

JSONWhiteSpace ::

<TAB><CR><LF><SP>

JSONString ::

"JSONStringCharactersopt "

JSONStringCharacters ::

JSONStringCharacter JSONStringCharactersopt

JSONStringCharacter ::

SourceCharacter but not double-quote " or backslash \ or U+0000 thru U+001F

\ JSONEscapeSequence

JSONEscapeSequence ::

JSONEscapeCharacter

UnicodeEscapeSequence

JSONEscapeCharacter :: one of

" / \ b f n r t

JSONNumber ::

-opt  DecimalIntegerLiteral JSONFractionopt  ExponentPartopt

JSONFraction ::

. [lookahead Ï DecimalDigit]

. DecimalDigits

JSONNullLiteral ::

NullLiteral

JSONBooleanLiteral ::

BooleanLiteral