JSON Repair
Fix broken JSON online: single quotes, trailing commas, comments, unquoted keys, truncated output and LLM answers in code fences. Shows every fix and a confidence score.
Runs in your browser · Nothing uploaded · No sign-up
Something not working, or missing a feature? Send feedback
About the JSON Repair
JSON Repair fixes text that is almost JSON: single quotes, unquoted keys, trailing commas, comments, Python True/None, missing commas and output that was cut off halfway. It also strips the Markdown fence and the chatty sentence an AI assistant puts around its answer, then lists every change it made and how sure it is of the result.
Everything runs in your browser, so your input is never uploaded to a server.
How to use the JSON Repair
- Paste the broken JSON, the model's whole answer, a JavaScript object or a Python dict.
- Read the message above the output: it lists what was fixed and a confidence score.
- Check the repaired JSON, especially if the confidence is low, then copy or download it.
Examples
Input
Here is the config:
```json
{
// service settings
name: 'api',
"port": 8080,
"debug": True,
"hosts": ["a.example.com", "b.example.com",],
}
```Result
{
"name": "api",
"port": 8080,
"debug": true,
"hosts": [
"a.example.com",
"b.example.com"
]
}The code fence and the sentence around it are removed, name gets quotes, 'api' gets double quotes, True becomes true, and the comment and the trailing commas are dropped.
Input
{"user": {"id": 7, "name": "Ada", "roles": ["admin", "dev"Result
{
"user": {
"id": 7,
"name": "Ada",
"roles": [
"admin",
"dev"
]
}
}The unterminated string, array and objects are closed. A lower confidence score tells you something was guessed: any data after the cut is missing.
Common mistakes
- Trusting a repaired document blindly. A truncated answer is closed, not completed. If the last values matter, ask for the output again instead of using the repair.
- Quotes inside strings. In "she said "hi" to me" the inner quotes are escaped by guessing where the string ends. Check such values, or escape the quotes at the source.
- Several values at the top level. JSON Lines or two objects pasted one after another are combined into an array. If you meant only the first, delete the rest before repairing.
Works well with the JSON Repair
- JSON Validator: confirm the repaired document is valid and see its structure.
- JSON Formatter: sort keys or change the indentation of the result.
- JSON Escape / Unescape: unwrap JSON that was stringified inside a string first.
Frequently asked questions
How is the confidence score calculated?
Cosmetic fixes such as quotes, trailing commas and comments barely lower it, because they cannot change the meaning. Guesses, such as closing a document that was cut off, adding a missing colon or escaping a quote inside a string, lower it more. 100% means the input was already valid.
Can it repair JSON from ChatGPT or other AI assistants?
Yes. It removes the code fence and the text before and after the JSON, and fixes the usual mistakes: comments, trailing commas, single quotes and output that stopped at the token limit. A truncated answer is closed, but the data that was never generated cannot be recovered.
What if the repair is wrong?
It is a best guess at what the author meant. Compare the result with the original, and treat a low confidence score as a reason to check the data by hand before you use it.
Is my data uploaded?
No. The repair runs in your browser, so logs, API responses and AI output stay on your device.
Does it change number values?
No. Numbers keep their digits, so a long ID like 12345678901234567890 is not rounded. Only the notation is tidied: +1 becomes 1, .5 becomes 0.5 and hex such as 0x1F becomes 31.
Related tools
JSON Formatter
Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.
HTML Formatter
Format and beautify messy or minified HTML into clean, indented markup with Prettier, including embedded CSS and JavaScript. Runs locally in your browser.
CSS Formatter
Format and beautify CSS, SCSS and Less online with Prettier. Turn minified or messy stylesheets into readable, consistently indented code in your browser.
JavaScript Formatter
Format and beautify JavaScript and JSX online with Prettier. Choose indentation, quotes, semicolons and line width; your code is formatted in your browser.
TypeScript Formatter
Format and beautify TypeScript and TSX online with Prettier, including types, generics and decorators. Choose indentation, quotes and semicolons.
PHP Formatter
Format PHP code online with Prettier for PHP (@prettier/plugin-php): PSR-12 braces, spacing and 4-space indentation. No install, and nothing is uploaded.