JSON repairer
Automatically repair and fix malformed JSON data. Corrects common JSON syntax errors like missing quotes, trailing commas, unescaped characters, concatenated strings, comments, and more. Instantly validates and formats broken JSON into valid, properly structured output.
Input
Output
Guide
Why does JSON break?
JSON has strict rules: keys and text in double quotes, no comments and no comma after the last item. JSON copied from a log, a chat, JavaScript or Python code, or an AI model's answer often breaks one of them, and a parser then rejects the whole document over a single character.
Tool description
Paste broken JSON into the first editor, and the repaired JSON appears in the second one as you type, ready to copy. Format repaired JSON, on by default, indents the result with two spaces; turn it off to get everything on one line. Insert sample fills in a messy example to try. When the input is too broken to repair, the tool shows the error and the position where it got stuck.
The repair is done in your browser by jsonrepair, a JavaScript library.
Features
- Adds missing quotes, commas and closing brackets, and turns single or curly quotes into double quotes
- Removes comments, trailing commas and Markdown code fences around the JSON
- Turns Python's
True,FalseandNoneintotrue,falseandnull
What it fixes
{name: 'Sunflower'}becomes{"name": "Sunflower"}{"colors": ["yellow", "orange",],}loses its trailing commas{"message": Hello World}gets quotes around the text- JSON that was cut off, such as
{"data": [1, 2, 3, gets its missing brackets - JSONP wrappers like
callback({...})and MongoDB values likeNumberLong(2)are removed, keeping the data inside - Several objects on separate lines, as in newline delimited JSON, become one array
Good to know
- Repairing means guessing, so check the result. Plain text with no JSON in it comes back as one JSON string, and a number with a leading zero, like 01, becomes the text "01".
- Text around the JSON, such as "Here is the JSON:" in front of it, makes the repair fail. Delete it first.
- Very long numbers get rounded, as in JavaScript: 12345678901234567890 becomes 12345678901234567000.