JSON reference

JSON syntax and data type reference

Review strict JSON objects, arrays, strings, numbers, booleans, null values, escaping rules, and common differences from JavaScript object literals.

10 min read Reviewed July 19, 2026 Professional reference

Document summary

A compact technical reference for writing and validating strict JSON that can be opened in standards-compliant parsers.

Key takeaways

  • Property names and strings use double quotes.
  • JSON supports objects, arrays, strings, numbers, true, false, and null.
  • Comments, trailing commas, undefined, NaN, and Infinity are not strict JSON.
01

JSON has a small set of value types

TypeExampleImportant rule
Object{"name":"Ava"}Keys are double-quoted strings
Array[1,2,3]Values are ordered and separated by commas
String"hello"Double quotes and control characters must be escaped
Number12.5No NaN, Infinity, or leading plus sign
BooleantrueLowercase true or false
NullnullLowercase null
02

Objects and arrays define structure

An object contains name-value members inside braces. An array contains ordered values inside brackets. Values can be nested to any practical depth supported by the parser and available memory.

Commas appear between members or elements, never after the final item in strict JSON.

Invalid
{
  name: "Ava",
  "roles": ["editor",],
}
Valid
{
  "name": "Ava",
  "roles": ["editor"]
}
03

Strings require double quotes and valid escapes

JSON strings use double quotes. A quotation mark, backslash, or control character inside the string must be escaped. Unicode characters may appear directly when the encoding supports them or as escape sequences.

CharacterJSON escape
Quotation mark\"
Backslash\\
New line\n
Carriage return\r
Tab\t
Unicode code unit\uXXXX
04

JSON numbers use a restricted decimal grammar

JSON numbers may include a minus sign, integer digits, a fractional part, and an exponent. Leading zeros are not allowed except for zero itself.

Large integers and precise decimals may lose precision in some programming languages. Use strings when exact identifiers or arbitrary precision values must be preserved.

  • Valid: 0, -12, 3.14, 6.02e23
  • Invalid: +1, 01, .5, NaN, Infinity
  • Review precision after parsing in JavaScript and other floating-point environments.
05

JSON is not a JavaScript object literal

JavaScript object literals can support comments, single quotes, unquoted identifiers, methods, undefined, and other language features. Strict JSON supports none of those additions.

Use JSON.parse for strict JSON and avoid evaluating JSON text as executable code.

06

Validate before using JSON

  1. 1

    Confirm the document has one complete top-level value.

  2. 2

    Use double quotes for keys and strings.

  3. 3

    Remove comments and trailing commas.

  4. 4

    Check escape sequences.

  5. 5

    Review number precision and data types.

  6. 6

    Validate against JSON Schema when the document is an API or data contract.

Jump to tool

Open the JSON Formatter and validate an example

Open tool