What counts as valid JSON
RFC 8259 is strict. Common mistakes that fail validation:
- Trailing commas —
[1, 2, 3,]is invalid. - Single quotes — strings must use double quotes.
- Comments — // and /* */ are not JSON.
- Unquoted keys — object keys must be quoted strings.
- Numbers with leading zeros —
0123is invalid (octal-looking). - NaN, Infinity, undefined — not representable in JSON.