Invalid JSON is one of those problems that stops everything: an API call fails, a config file won't load, a deployment breaks — often with a cryptic message like Unexpected token } in JSON at position 42. The good news is that the vast majority of invalid JSON comes from a small, predictable set of mistakes. Once you can read a validator's output, fixing them takes seconds.
What does "validate JSON" actually mean?
JSON follows a strict grammar defined in RFC 8259. A validator parses your text against that grammar and reports the first place it breaks. Valid JSON means any standard parser — JavaScript's JSON.parse(), Python's json.loads(), etc. — can read it without error.
Validation is about syntax, not shape. "Is this correct JSON?" is a different question from "does this JSON have the fields my app expects?" The second is schema validation — see the JSON Schema Generator for that.
How to validate JSON in 3 steps
- Open the JSON Validator and paste your JSON (or drag in a
.jsonfile). - Read the result: valid JSON shows a formatted preview; invalid JSON lists each error with its line and column and a suggested fix.
- Click an error to jump straight to that spot in the input — or hit Apply auto-fix to repair the common cases automatically.
Everything runs locally in your browser, so it is safe to paste API responses or config that contain tokens or secrets — nothing is uploaded.
The 7 most common JSON errors (and how to fix them)
1. Trailing commas
{ "name": "John", "age": 30, } // comma after the last valueLegal in JavaScript, illegal in JSON. Remove the comma before the closing } or ]. This is the single most common cause of invalid JSON.
2. Single quotes
{ 'name': 'John' } // invalid
{ "name": "John" } // validJSON requires double quotes for every key and every string value. Single quotes are never valid.
3. Unquoted keys
{ name: "John" } // invalid
{ "name": "John" } // validThat is a valid JavaScript object literal, but not JSON. Every key must be wrapped in double quotes.
4. Comments
{
"port": 8080 // the server port <- invalid
}JSON has no // or /* */ comments. Remove them, or use JSONC/JSON5 if your tooling supports it (most config loaders do not).
5. Mismatched or missing brackets
{ "items": [1, 2, 3 } // ] is missingEvery { needs a } and every [ needs a ]. A validator points you to where the structure stops making sense — usually a line or two after the real mistake.
6. Wrong value types
{ "active": True, "count": 01, "note": undefined } // all invalidJSON booleans are lowercase true/false. Numbers can't have leading zeros, and undefined and NaN don't exist in JSON — use null instead.
7. Unescaped characters in strings
{ "path": "C:\Users\Ada" } // backslashes must be escapedInside a JSON string, backslashes, double quotes, and control characters (like raw line breaks) must be escaped — \\, \", \n. A literal newline inside a string is invalid.
Reading a validator's error message
Native parser errors are terse (Unexpected token … at position N). A good validator translates the raw position into a line and column and adds a plain-English suggestion — "Trailing comma before }" or "Single quotes are not valid JSON." Fix the first error and re-validate; one mistake often hides the ones after it.
Validate, repair, format — the full flow
- Validate to find what's wrong.
- Repair to auto-fix trailing commas, single quotes, and unquoted keys.
- Format to pretty-print the clean result. New to formatting? See What Is JSON Formatting?
Frequently asked questions
Why does my JSON say "unexpected end of input"? A bracket or brace was never closed, or the file was truncated. Check the very end of the document.
Is it safe to paste sensitive JSON? In a browser-based validator like ours, yes — validation happens locally and nothing is sent to a server.
What is the difference between a validator and a linter? A validator checks syntax (is it parseable?). A linter additionally checks style and conventions. For JSON, syntax validation is what you need 99% of the time.
Can comments ever be valid? Not in standard JSON. Some formats (JSONC, JSON5) allow them, but most parsers will reject them.
Wrapping up
Almost every "invalid JSON" error is one of the seven mistakes above. A validator that shows you the exact line, column, and a suggested fix turns a frustrating hunt into a five-second correction.
Validate your JSON for free →Related free tools: JSON Repair · JSON Formatter · JSON Schema Generator · All JSON Tools