JSON
JSON (JavaScript Object Notation, RFC 8259) is a text-based data format for representing structured values as objects, arrays, strings, numbers, booleans, and null.
Updated: 2026-08-11
Lookup
JSON | Definition |
|---|---|
string | Double-quoted Unicode text with backslash escapes (\", \\, \/, \b, \f, \n, \r, \t, \uXXXX). Single quotes are not valid JSON. |
number | Optional leading -, digits, optional fraction (.digits), optional exponent (e/E[+-]digits). No leading zeros, no NaN/Infinity, no hex literals. |
object | Unordered {"key": value, ...} pairs; keys must be double-quoted strings. |
array | Ordered [value, value, ...] list; elements may be any JSON type, including nested objects/arrays. |
boolean | true or false, lowercase only. |
null | Lowercase null, representing the absence of a value. |
Examples
Minimal valid document
json
{
"id": 1,
"active": true,
"tags": ["a", "b"],
"meta": null
}Escaping a quote and a newline inside a string
json
{
"note": "Line one\nSays \"hi\""
}Common Mistakes
!
Trailing commas
{"a": 1,} is invalid JSON — unlike a JavaScript object literal, JSON has no trailing-comma allowance.
!
Single-quoted strings or keys
{'a': 1} is invalid; JSON requires double quotes for both keys and string values.
!
Unquoted keys
{a: 1} is invalid; object keys must be quoted strings.
!
NaN, Infinity, or undefined
None of these are valid JSON tokens, even though all three are valid JavaScript values.
!
Comments
// line and /* block */ comments are not part of the JSON grammar — see the JSON vs JSON5 vs JSONC guide for formats that add them back.
Related Concepts
JSON