JSON Formatter and Validator
Pretty-print JSON to make its structure readable, and validate it to find exactly where a parser will fail.
What JSON actually allows
JSON is far stricter than most hand-written examples suggest. Keys must be double-quoted strings. Trailing commas are invalid. Comments are not part of the specification. Single quotes are not valid string delimiters. Numbers cannot have leading zeros or a leading +, and NaN and Infinity are not permitted.
Common causes of parse errors
- Trailing comma after the last element of an object or array — the single most frequent error.
- Single quotes copied from JavaScript object literals, which are not JSON.
- Unescaped control characters, especially raw newlines inside strings.
- A byte-order mark at the start of a UTF-8 file, invisible in most editors.
- Comments, valid in JSON5 and JSONC but rejected by strict parsers.
Formatting versus validating
Formatting only changes whitespace, so it can never alter meaning. Validation confirms the document parses at all. A formatter that silently accepts trailing commas is doing you no favours: it will look correct here and fail in production against a strict parser.