Free tool
JSON repair
Paste broken JSON — trailing commas, single quotes, markdown fences, a response that got cut off halfway — and get strict, valid JSON back. No signup, no limits. Nothing leaves your browser.
What it repairs
- Markdown fences and stray prose The “Sure! Here's the JSON:” sentence and the surrounding code fence are removed.
- Truncated output A response cut off mid-object keeps every complete field, with open strings, arrays and objects closed properly.
- Trailing and missing commas Extra commas before a closing bracket are dropped; missing ones between items are inserted.
- The wrong kind of quote Single quotes and curly “smart” quotes become straight double quotes.
- Unquoted keys JavaScript-style object keys get the quotes JSON requires.
- Comments Line, block and hash comments are stripped, none of which JSON permits.
- Values from other languages Python's True, False and None, Ruby's nil, plus NaN, Infinity and undefined, become their JSON equivalents.
- Malformed numbers Hex literals, leading plus signs and digit separators are normalised.
Why model output breaks parsers
Asking for JSON and enabling JSON mode constrains the shape of the response, not the outcome. Three failures account for most production incidents.
The response is empty. Providers document that a JSON-mode request can still return empty content, particularly with reasoning modes and a tight token budget. Your parser receives an empty string, not an error.
The response is truncated. Hit the token ceiling mid-object and the text simply stops. The result is unparseable, and the finish reason that would have told you why is only visible after the damage is done.
The response is decorated. Models trained on chat wrap data in code fences and introduce it with a sentence. Both are invisible to a human and fatal to a parser.
This tool fixes a response you already have. The durable fix is to validate before your code sees the data and repair or retry on failure, rather than parsing optimistically and discovering the problem in production.
Common questions
- Is my data uploaded anywhere?
- No. The repair runs entirely in your browser — there is no request to any server, nothing is stored and nothing is logged. It is safe to paste production data. You can disconnect from the network and it will still work.
- Can it recover JSON that was cut off partway through?
- Yes. Every complete field read before the cut is kept, and anything left open is closed. You get the data that survived instead of a parser error.
- How is this different from a JSON formatter?
- A formatter needs valid JSON to begin with. This reads invalid input, works out the value it was trying to express, and writes that value out fresh — which is why the result is always parseable rather than merely tidier.
- Will it ever change my data?
- It only makes structural repairs, and it lists every one it made underneath the result. Values that cannot be expressed in JSON — NaN and Infinity — become null, because JSON has no other way to hold them.
- How do I stop this happening in production?
- Put the guarantee in the request path rather than cleaning up afterwards. The JSON Guarantee API is a drop-in OpenAI-compatible endpoint that returns parseable JSON or an explicit failure — one line to switch.
Repairing it by hand doesn't scale
This page is genuinely free and always will be. But if you are pasting broken output into a repair tool more than once, the problem is in your pipeline, not in that one response.
See the JSON Guarantee API → · Clean messy business records free →