JSON Repair - Fix Invalid and Broken JSON Online
Paste JSON that will not parse and get valid JSON back. The repair fixes trailing commas, single quotes, unquoted keys, comments, Python-style True/None, missing brackets and output that was cut off mid-way, which is common with AI chat responses.
How to repair JSON
- Paste the broken JSON into the left editor, or open or drop a file.
- Press Repair (or Ctrl+Enter), or leave Live on to repair as you type.
- Valid, formatted JSON appears on the right. Check it in tree view, then copy or download it.
What it fixes
- Trailing commas after the last item of an object or array.
- Missing commas between items.
- Single quotes and curly quotes (
'name',“name”) around keys and strings. - Unquoted keys, as in JavaScript object literals:
{name: "Ada"}. - Comments:
// lineand/* block */comments are removed. - Python and JavaScript values:
True,False,Noneandundefinedbecometrue,falseandnull. - Truncated output: missing closing brackets and braces are added, which helps with JSON that was cut off by a log line limit or a chatbot reply.
- Wrapped JSON: Markdown code fences, JSONP callbacks such as
callback({...})and MongoDB types such asObjectId("...")are unwrapped. - Newline-delimited JSON: several objects on separate lines become a single array.
- Unescaped control characters and line breaks inside strings.
Check the result
Repair is a best guess. When text was cut off, the missing part cannot be recovered, only closed off. Look over the output before you use it, and use JSON Compare if you want to see exactly what changed between two versions. If the input was already valid, the status line says so and the output is simply formatted.
If something cannot be repaired, the error points to the line and column where the repair stopped.
Example
{
name: 'Ada Lovelace',
languages: ['English', 'French',],
active: True,
// cut off here
projects: [{title: 'Analytical Engine'
becomes valid JSON with quoted keys, double quotes, true, no comment and closed brackets.
Private by design
The repair runs in your browser using the open-source jsonrepair library. Nothing you paste is uploaded.