JSON Validator and Formatter
Validate pasted JSON and pretty-print it with two-space indentation; invalid input gets the exact line and column where it first breaks, plus depth, node and key counts.
Fill in the values and calculate
The form sends itself back to this page — results print below, computed on the server.
No results yet: fill the form above and press Calculate.
About JSON Validator and Formatter
The pasted text is parsed strictly as one JSON value. Valid input is pretty-printed with two-space indentation and counted: depth is the longest chain of nested objects and arrays, nodes counts every value (each container and every string, number, true, false and null), and keys counts the object members that a reader would see.
When the text is not valid JSON, a grammar scan pinpoints where the text first breaks: an exact line and column for an unquoted key, a missing comma, a trailing comma, an illegal escape, a leading zero in a number, or text after the value. JSON.parse messages differ between engines, so the position comes from this scan instead.
Formatted output longer than 4000 characters is truncated in the display block, and the note says so; the counts always describe the whole document. JSON has no comments, trailing commas or hex escapes, and none of those are accepted.
Questions about JSON Validator and Formatter
What counts as depth?
A chain of nested containers: a top-level object or array is depth 1, and each further object or array adds one. A bare top-level string or number is depth 0.
Does node count include keys?
No. Nodes counts values: every container plus the strings, numbers, true, false and null inside them. Keys is reported separately as a count of object members.
Why does my JSON fail?
JSON allows no comments, no trailing commas, no single quotes and no unquoted keys; numbers may not carry leading zeros or a leading plus. The error names the exact line and column where the first break happens.
Is duplicate-key JSON valid?
It parses: the grammar permits it. Every parser then keeps only the last value for that key, so the key count here reports what a reader would actually see.
Bookmark and homescreen
- Press Ctrl+B now (or Cmd+B on macOS) to bookmark this page in your browser.
- Drag this link to your bookmarks bar and it will always open this tool: JSON Validator and Formatter.
- On a phone: open in Chrome/Safari and use "Add to Home Screen" — the site ships a homescreen icon and manifest, so it installs like an app.
- Two addresses work:
https://useful-utilities.com/json-validator-formatter/andjson-validator-formatter.useful-utilities.com. Copy whichever you prefer.