What it repairs
The repair reads your text once, keeps everything that is already valid exactly as written and rewrites only the broken parts. It handles the damage that real pasted data carries:
- Chat assistant output. Markdown code fences such as ```json and the chatty sentences around them are removed, and the JSON inside is repaired.
- Code instead of data. JSONP callbacks like
callback({...});,var data = {...};,export default {...}and anti-hijacking prefixes such as)]}'are stripped. - Quotes. Single quotes, backticks and curly quotes (“ ” and ‘ ’) used as string delimiters become straight double quotes; unquoted keys get quotes.
- Python and JavaScript literals.
True,FalseandNone, tuples,undefined,NaNandInfinityare converted, and MongoDB shell wrappers likeNumberLong(5)are unwrapped. - Punctuation. Trailing commas, doubled commas, missing commas and missing colons, plus every style of comment (
//,/* */and#). - Numbers. Hex, octal and binary literals, leading zeros, a leading
+and.5become plain decimals, digit for digit:0xFFFFFFFFFFFFFFFFFFturns into its exact decimal value, not a rounded double. - Strings. Raw line breaks and tabs inside strings are escaped, invalid escapes such as
\x41are rewritten, and a closing quote missing at the end of a line is added. - Cut-off input. A response truncated mid-way gets its open strings, arrays and objects closed.
- Several documents. JSON Lines or objects pasted one after another are wrapped in a single array, and a whole document stored inside a string (double-encoded) is decoded.
Every change is listed, with its position
Below the editors, the Fixes panel lists each edit in input order with its line and column, for example “7:36 Removed a trailing comma”. Click an entry and the broken spot is selected and highlighted in your input, so you can confirm the change against the original. The chips above the list summarise which kinds of fixes were applied.
Switch the right-hand pane to Line diff to see the whole change set as a unified diff. The diff compares your text with the minimal repair, before pretty-printing, so only lines that were actually edited show up. The Output menu decides what you copy or download: pretty-printed with two or four spaces or tabs, minified, or Keep my layout, which returns your text with only the broken parts changed.
When you are done, Open in JSON formatter carries the result to the JSON formatter for sorting, conversion or validation against a schema.
Guesses are flagged, never hidden
Some damage has a single correct fix: a trailing comma or a single-quoted string means only one thing. Other damage needs a judgement call, and those fixes carry a yellow note explaining what was assumed:
- A missing closing quote is placed at the end of the line, and a trailing comma inside the string is treated as the separator.
- A number with a leading zero, such as
0755, is read as decimal 755; the note tells you it would be 493 as an old octal literal, which matters for file permissions. - Truncated input gets
nullfor a value that never arrived, and the notes point out that items after the cut are missing. NaN,Infinityandundefinedhave no JSON equivalent and becomenull.- Several values in a row are combined into an array, and text around the JSON is dropped as commentary.
Use Only fixes to check to filter the list down to these. If a spot cannot be repaired with confidence at all, nothing is invented: you get the strict parser’s error and its location instead, and the repair runs again as soon as you edit the text.
Private, and fast on large files
The repair runs in a background worker inside your browser. Nothing you paste is uploaded, logged or stored, which matters for API responses with customer data or tokens. Multi-megabyte inputs are handled without freezing the page, numbers keep every digit, and duplicate keys are kept and reported rather than silently merged. To check a document without changing it, use the JSON validator; to explore a repaired document, open it in the JSON Viewer.
Examples
A chat assistant reply with a code fence
The fence and the chatty sentences around it are removed, then the two trailing commas inside the JSON are fixed.
Sure! Here is the user record you asked for:
```json
{
"name": "Ada Lovelace",
"born": 1815,
"languages": ["English", "French",],
}
```
Let me know if you need anything else.{
"name": "Ada Lovelace",
"born": 1815,
"languages": [
"English",
"French"
]
}A Python dict printed with print()
Single quotes, True and None, and a tuple are converted; the double-quoted string with an apostrophe is kept as it is.
{'id': 7, 'active': True, 'tags': ('admin', 'ops'), 'manager': None, 'note': "it's fine"}{
"id": 7,
"active": true,
"tags": [
"admin",
"ops"
],
"manager": null,
"note": "it's fine"
}A JavaScript object literal
The assignment, the comment and the trailing comma are removed, keys are quoted, 0xFF becomes 255 and undefined becomes null with a warning.
var config = {
// feature flags
retries: 3,
mask: 0xFF,
name: 'edge-01',
timeout: undefined,
};{
"retries": 3,
"mask": 255,
"name": "edge-01",
"timeout": null
}A truncated API response
The cut-off key gets null and every open bracket is closed; the fixes are flagged because the rest of the response is missing.
{"orders": [{"id": "A-1", "total": 42.5}, {"id": "A-2", "tot{
"orders": [
{
"id": "A-1",
"total": 42.5
},
{
"id": "A-2",
"tot": null
}
]
}Common errors and how to fix them
| Error | Cause | Fix |
|---|---|---|
Could not repair automatically: An object member has a value but no key | An object contains a bare array or object where a “key”: value pair should be, such as {[1, 2]}. There is no way to know what the key was meant to be. | Add the missing key by hand (for example {“items”: [1, 2]}); the repair runs again as you type. |
There is no JSON to repair: the input is empty | The editor is empty or holds only whitespace, or a code fence contains nothing. | Paste the text that failed to parse, or open the file with Open file. |
Kept a quote inside a string as textExplained | A double quote appeared in the middle of a string that continues afterwards, as in “She said “hi” to me”. It was kept as part of the text and escaped. | Check the highlighted string. If the quote really ended the string, add the missing comma or colon after it instead. |
Closed the string at the end of line 4Explained | A string had no closing quote, and the next line starts a new key, so the string was ended at the line break. | Confirm the value is complete; if the text was meant to continue onto the next line, join the lines and escape the break as \n. |
Wrapped 3 separate JSON values in an array | Several documents followed each other, as in JSON Lines output or log files with one object per line. | Keep the array if you want one document, or use the NDJSON formatter to keep one document per line. |
Frequently asked questions
Will the repair change values that were already valid?
No. Valid JSON comes back byte for byte with no fixes listed, and in broken input only the broken parts are rewritten. Numbers keep their exact digits, even ones too large for JavaScript.
How is this different from the Fix it button in the formatter?
Fix it uses the same repair engine inside the formatter. This page adds the full list of fixes with positions, the warnings for guesses, a line diff and output layout choices, and it handles very large inputs.
Can it fix JSON that a chat assistant wrapped in Markdown?
Yes. Code fences such as ```json and the sentences before and after them are removed, and the JSON inside is repaired. If the reply holds several code blocks, the first JSON block is used and a note says so.
What happens to NaN, Infinity and undefined?
They become null, because JSON has no way to write them, and each replacement is flagged. If you need to keep the distinction, store them as strings in the source instead.
Is my data sent anywhere?
No. The repair runs in a web worker in your browser, and the page makes no network requests with your text.
Why did it put my documents in an array?
JSON allows only one top-level value. When several follow each other, wrapping them in an array is the only way to keep all of them, and the fix list says how many were combined.