A comprehensive reference manual covering JSON syntax rules, data types, escape characters, and real-world specifications.
JSON (JavaScript Object Notation) is a standardized, language-independent data interchange format defined by RFC 8259 and ECMA-404. It uses human-readable text to store and transmit data objects consisting of attribute-value pairs and arrays.
Strict JSON supports exactly six data types. Any other type (such as functions, undefined, or Symbols) is invalid in JSON.
{
"string": "UTF-8 text wrapped in double quotes",
"number": 42.5,
"boolean": true,
"null": null,
"array": [1, 2, 3],
"object": {
"key": "value"
}
}Strings must always be enclosed in standard double quotes ("). Single quotes (') and backticks (`) are illegal in standard JSON.
Special characters must be escaped using a backslash (\):
\" — Quotation mark\\ — Reverse solidus (backslash)\/ — Solidus (forward slash)\b — Backspace\f — Form feed\n — Newline\r — Carriage return\t — Horizontal tab\uXXXX — 4-hex-digit Unicode character{
"quote": "She said, \"Hello!\"",
"backslash": "C:\\Users\\AppData",
"newline": "First line\nSecond line",
"unicode": "\u2602 (umbrella emoji)"
}JSON numbers can be integers, decimal fractions (floats), or exponential/scientific notation (e.g. 1.5e3). Leading zeros (like 05), hexadecimal (0xFF), NaN, and Infinity are not permitted.
Booleans are written in lowercase: true or false. Title-cased values like True (common in Python) will cause parse errors.
The keyword null represents an intentional absence of value.
An unordered set of name/value pairs wrapped in { }. Every key must be a valid string enclosed in double quotes followed by a colon :.
An ordered collection of values wrapped in [ ], separated by commas. Arrays can contain mixed data types or nested arrays/objects.
//) or multi-line (/* */) comments.While JSON syntax is derived from JavaScript object literal syntax, they have important differences:
undefined, and trailing commas; JSON prohibits all of them.Validate your JSON syntax against these rules in our JSON Validator, pretty-print it in the JSON Formatter, or read the Common JSON Errors Guide.