~ / developer / json-validator

✅ JSON Validator

Checks JSON syntax the moment you type, highlights the broken line, and explains in plain English what went wrong and how to fix it.

error location

        
structure stats

How to use the JSON validator

  1. Paste your JSON into the editor. It's checked on every keystroke; the page opens with a broken example so you can see what errors look like.
  2. If something's wrong, the bad line is highlighted in red and the status bar tells you the line, column and what went wrong in plain English. The "error location" panel shows the surrounding lines with a ^ pointing at the exact character.
  3. 💡 hints explain the usual suspects — trailing commas, single quotes, comments, unquoted keys — and how to fix them. try auto-fix repairs those common mistakes in one click.
  4. When the JSON is valid you get structure stats (key count, max nesting depth, counts by type) and warnings for things that are legal but risky, like duplicate keys or huge integers.

Need to indent or minify? Use the JSON Formatter. This page focuses on answering "why won't this parse?"

JSON syntax rules in one table

JSON (JavaScript Object Notation, RFC 8259) looks like a JavaScript object literal but is much stricter. Plenty of things that work in JS code are errors in JSON.

Rule❌ Invalid✅ Valid
Keys are double-quoted strings{name: 1}{"name": 1}
Strings use double quotes only'smith'"smith"
No trailing commas[1, 2, ][1, 2]
No comments// noteuse a "_comment" key
Only six value typesundefined, NaNnull
No leading zeros or bare decimals007, .57, 0.5
Line breaks inside strings must be escaped(pressing Enter)"a\nb"

JSON has exactly six value types: object {}, array [], string, number, true/false and null. Dates are best sent as ISO 8601 strings like "2026-10-05T09:00:00Z", and very large integers (IDs) as strings.

How the line and column are found

Instead of relying on JSON.parse, whose messages differ between browsers ("Unexpected token } in JSON at position 87"), this validator walks the input character by character with its own parser that follows the JSON grammar exactly. That's how it can report the precise first point where the grammar breaks. Lines and columns start at 1; the column is the character position within that line.

Keep in mind that the place an error is detected can be after the actual mistake. A missing comma is reported at the quote of the next key, and an unclosed bracket is reported at the end of the file. The hints point you to "the end of the previous line" or "the bracket that was never closed" in those cases.

Warnings: valid but risky

Auto-fix only removes comments, converts single quotes, quotes bare keys, converts True/False/None/undefined and drops trailing commas. Always review the result. Your JSON never leaves the browser.

FAQ

What does "Unexpected token in JSON at position" mean?
JSON.parse hit a character that is not allowed at that point, and the position is a zero-based character index. Paste the JSON here and the validator converts that position to a line and column and highlights it.
Can JSON have comments?
Standard JSON has no comments. For config files, use JSONC (what VS Code settings use), JSON5 or YAML, or put notes under a key such as "_comment".
Why is a trailing comma an error in JSON?
The JSON grammar only allows commas between items. JavaScript objects and arrays accept a trailing comma, which is why it is such a common mistake, but JSON.parse rejects it.
How is this different from a JSON formatter?
A formatter re-indents or minifies valid JSON. The validator focuses on invalid JSON: exact error location, the reason, fix hints, structure stats and warnings.
How do I fix "Unexpected end of JSON input"?
The JSON was cut off — usually a missing closing } or ], or an empty response body. Paste it here; the hint tells you which bracket on which line was never closed.

Related tools