What Makes JSON Invalid
JSON (RFC 8259) is stricter than most developers expect. Common reasons validation fails:
- Trailing commas — a comma after the last item in an object or array:
{"a": 1,}. Allowed in JSON5, not in JSON.
- Single-quoted strings —
{'key': 'value'}. All strings must use double quotes.
- Unquoted keys —
{key: "value"}. Property names must be double-quoted strings.
- Comments — JSON has no comment syntax. Neither
// line nor /* block */ comments are valid.
- Special number values —
NaN, Infinity, and -Infinity are not JSON primitives.
- Unclosed structures — a missing
}, ], or " ends parsing prematurely.
JSON vs JSON5 vs JSONC
Many configuration files look like JSON but are JSON5 or JSONC (JSON with Comments), which relax some restrictions:
This formatter validates against strict JSON (RFC 8259) but flags trailing commas and comments as warnings — non-standard patterns that it can identify and describe rather than just rejecting outright.
How the Tree View Works
After valid JSON is parsed, the tree view renders the entire structure as nested collapsible sections. Each object and array can be opened or collapsed independently using the toggle arrow. Leaf values are color-coded by type for quick scanning: strings in green, numbers in blue, booleans in purple, null in gray.
The Expand All and Collapse All buttons open or close every node at once. For large JSON files with many nested arrays or objects, starting collapsed and expanding only the branches you need is more practical than scrolling through a fully expanded tree.
Formatting and Minifying
Formatted JSON uses 2-space indentation by default — the most common convention for web APIs and configuration files. The minified version removes all whitespace not inside string values, producing a single compact line — useful for reducing HTTP payload size or embedding JSON in source code.
A 10 KB formatted JSON file typically minifies to 6–7 KB — a 30–40% reduction. For deeply nested structures with long string values, the savings are proportionally smaller because the values, not the whitespace, dominate the byte count.