What was fixed
- Paste some broken JSON to see what needs fixing.
Fix broken JSON, and see exactly what was changed.
JSON is strict. Keys must be double-quoted, no comments are allowed, no trailing comma after the last item, and every bracket must close. Almost nothing that produces JSON in the real world respects all of that. JavaScript object literals use unquoted keys, Python prints True and None, language models wrap their output in markdown fences and stop mid-document, and config files pick up comments over time.
Repairing means turning that near-JSON into something a parser will accept, without changing what it says. This tool reads your input as a stream of tokens rather than running find and replace over it, which is what keeps the contents of your strings safe. A comma, a brace, or a // inside a string value is data, not syntax, and it is left exactly as written.
Most repair tools skip the part that matters most. This one shows you what it changed. Every repair is listed with a count, so you can see that it quoted six keys and removed two trailing commas rather than just handing back a block of JSON and hoping. You can also switch any individual repair off, which is how you find out precisely what was wrong in the first place.
// line comments and /* block */ comments.True, False and None, plus NaN, Infinity and undefined.Once it parses, the JSON Editor lets you edit it in a tree, the JSON Formatter beautifies it, and the JSON Validator checks it in detail. There are more in our free developer tools.
The repairs are deliberately conservative, and string contents are never touched, so a comma or brace inside a value is safe. Two repairs do involve a judgment call, since closing a truncated document guesses where it should end, and quoting a bare word assumes it was meant to be text. Both are listed in the report so you can see they happened, and both can be switched off.
Then nothing happens to it. The badge says it was already valid, the report lists no fixes, and the output parses to exactly the same value. That is checked automatically against thousands of generated documents, because a repair tool that damages good input is worse than no repair tool.
Because some damage cannot be guessed safely. If a document has lost a chunk from the middle, or the structure is ambiguous, there is no correct repair, so the tool says so and names the line rather than inventing something. Turning individual repairs off can help you narrow down where the real problem is.
That is one of the cases it is built for. Markdown code fences, single quotes, Python style literals, trailing commas, and output that stops mid-object are all handled, which covers most of what models produce when asked for JSON.
By default it indents the result with two spaces. Set Output to "Keep as repaired" if you would rather see the minimal change, which is useful when comparing the before and after side by side.
No. The repair runs in your browser with JavaScript. Nothing is sent to a server, and the tool keeps working offline once the page has loaded.