CAI Context Tools

AI JSON Repair

Paste broken JSON from ChatGPT, Claude or Gemini and get valid, formatted JSON back, even if the reply was cut off.

Runs in your browser. Your text is never uploaded.

Valid JSON

Why AI models return broken JSON

Language models write JSON one token at a time, the same way they write sentences. That leads to familiar mistakes:

What this tool fixes

All of the above. It pulls the JSON out of the surrounding text, repairs the syntax, closes anything left open, and lists exactly what it changed. Then you can copy or download valid, formatted JSON.

If your JSON keeps getting cut off, the reply probably hit the model's output limit. The Context Window Calculator shows the limits for each model.

Frequently asked questions

Is my JSON uploaded?

No. Everything is processed in your browser.

Can it fix JSON that was cut off?

Yes. It closes open strings, arrays and objects so the data that did arrive becomes valid JSON. Anything after the cut-off point is still missing, so you may need to ask the AI to continue.

Will it change my data?

It only fixes syntax. Values stay the same, except NaN and undefined (which JSON doesn't allow) become null.

How do I stop the AI returning broken JSON?

Ask for 'only valid JSON, no code fences or explanation', or use the provider's structured output (JSON mode) option if you use the API.

Guides for this tool

See all guides →

More free AI tools