How to fix invalid JSON
- Paste the broken text into the left panel, upload a file (up to 5 MB) or use Load from URL. Click Sample to see a typical AI reply with a code fence, a comment, single quotes and a Python
True. - The error bar shows where the original fails to parse. Click Fix JSON or press Ctrl+Enter.
- The repaired, formatted JSON appears on the right with a message such as
Fixed: Removed markdown code fence, Trailing comma before } or ], Single-quoted strings or keys. If the input was already valid, it says so. - Review the result in Tree or Code view, pick an indent (2, 3, 4 spaces or tab), then Copy or Download .json.
What it repairs
Example input, pasted straight from a chat window:
Here is the JSON you asked for:
```json
{
// customer record
'name': 'Maya Patel',
"roles": ["admin", "editor",],
"active": True
}
```
Let me know if you need anything else.
Output:
{
"name": "Maya Patel",
"roles": [
"admin",
"editor"
],
"active": true
}
Message: Fixed: Removed markdown code fence, Trailing comma before } or ], Single-quoted strings or keys, Comments, Non-JSON literals (True/False/None/NaN/undefined).
The same pass also handles unquoted keys, curly quotes copied from a document, a UTF-8 byte order mark at the start of a file, and brackets that were never closed.
Limits and notes
- Review before you use the result. The fixer repairs syntax and leaves your strings and numbers as written, but the repair is heuristic and the notes name the categories it detected rather than every individual edit. Your input stays untouched on the left so you can compare.
- Truncated output is closed where the text ends, so the final value may be incomplete. The note tells you how many brackets were missing.
- Literal translations are the only value changes:
TrueandFalsebecometrueandfalse,Nonebecomesnull, andNaNbecomes the string"NaN"so nothing is dropped silently. - One document at a time. If a reply contains several fenced blocks, only the first is used; split them and fix each separately.
- Files up to 5 MB. Everything runs in your browser; nothing is sent to a server.
- Comments are removed, not preserved, because JSON has no comment syntax.
- To understand the original error message, see common JSON errors and Unexpected token in JSON. For model output specifically, read how to fix AI-generated JSON, and for the most frequent single mistake, trailing commas.