Every developer has seen it — the dreaded SyntaxError: Unexpected token when parsing JSON. A missing comma, a trailing comma, unquoted keys, or single quotes instead of double quotes. You know the fix is simple, but finding it in a 500-line JSON response is painful.
The Problem with JSON Validators
Tools like JSONLint tell you what's wrong — "Error at line 47, position 12." Great. Now you get to manually hunt through nested brackets to find that one missing comma.
What if a tool could just... fix it for you?
Auto-Fix JSON — The Approach
I built a tool that automatically detects and repairs common JSON syntax errors: JSON Auto-Fix
Here's what it repairs:
1. Missing Commas
//Broken:{"name":"Alice""age":30}//Fixedautomatically:{"name":"Alice","age":30}
2. Unquoted Keys
//Broken:{name:"Alice",age:30}//Fixed:{"name":"Alice","age":30}
3. Single Quotes
//Broken:{'name':'Alice','city':'NYC'}//Fixed:{"name":"Alice","city":"NYC"}
4. Trailing Commas
//Broken:{"name":"Alice","age":30,}//Fixed:{"name":"Alice","age":30}
5. Unmatched Brackets
//Broken:{"users":[{"name":"Alice"},{"name":"Bob"}//Fixed:{"users":[{"name":"Alice"},{"name":"Bob"}]}
6. Smart/Curly Quotes
When you copy JSON from Word, Slack, or a PDF, you get typographic quotes ("like these") instead of straight quotes. The tool replaces them automatically.
How It Works Under the Hood
The fix algorithm runs through multiple passes:
- BOM removal — strips invisible byte-order marks
- Smart quote replacement — curly → straight
- Single quote conversion — respecting strings already in double quotes
- Unquoted key detection — regex to find bare keys before colons
-
Trailing comma removal — removes commas before
}or] - Missing comma insertion — detects values on separate lines without separators
- Bracket balancing — counts opens vs closes and appends missing ones
-
Final parse test — attempts
JSON.parse()on the result
If it succeeds, you get perfectly formatted JSON. If it's too broken to fix, it tells you which fixes were applied and where it still fails.
Try It
jsonsuit.com/fix-json — paste broken JSON, click Fix, done.
No sign-up. No data sent to any server (everything runs client-side in your browser).
Other JSON Tools
While I was at it, I built a full suite of JSON tools — all free, all browser-based:
- JSON Formatter — pretty-print and validate with syntax highlighting
- JSON Compare — diff two JSON objects side-by-side
- JSON → TypeScript — generate interfaces from JSON
- JWT Decoder — inspect JWT tokens
- Bulk Convert — convert multiple JSON files at once (download as ZIP)
- JSON Path — extract data with JSONPath queries
Full toolkit: jsonsuit.com
What JSON tools do you use daily? Anything you wish existed? Let me know in the comments!