You pasted JSON into your editor and it broke. Now what?
Most developers jump straight to formatting — prettify it, add indentation, make it readable. But formatting only works on valid JSON. If there's a syntax error, a formatter either silently
fails or outputs garbage. What you actually need first is a validator that tells you where it broke.
The difference
Validator — parses the JSON and reports the exact line and column of the first syntax error. A missing comma, an unquoted key, a trailing bracket — it finds it instantly. You fix it, then
format.
Formatter — takes valid JSON and outputs a clean, indented version. 2 spaces (most JS projects), 4 spaces (Python/Java convention), or tabs. No logic, just whitespace.
The workflow is: validate → fix → format. Not format → hope.
The most common JSON errors in the wild
-
Trailing commas — valid in JS objects, invalid in JSON.
{"a": 1,}breaks. -
Single quotes — JSON requires double quotes everywhere.
{'key': 'value'}breaks. -
Unquoted keys —
{key: "value"}is JS object syntax, not JSON. -
Comments — JSON has no comment syntax.
// this breaks things. - Undefined / NaN / Infinity — not valid JSON values.
Where this comes up in real work
- Debugging an API response that your JSON.parse() is rejecting
- A config file that refuses to load with a cryptic error
- Copying JSON from a terminal that got line-wrapped and corrupted
- Checking a Postman payload before sending
The validator tells you the exact character position of the problem. Much faster than counting braces.
QTNest's JSON Validator & Formatter runs entirely in your browser — your data never leaves your machine.
Top comments (0)