LLM JSON Repair
Paste the raw text an LLM gave you back — even with a markdown
fence around it, prose before or after, trailing commas, single
quotes, Python's True/False/None,
or output that got cut off mid-token by a token limit — and get
back valid, parsed JSON. Everything runs in your browser; nothing
is uploaded.
Why does JSON.parse() fail on my LLM's output even though it looks like valid JSON?
LLMs write JSON-like text, not guaranteed-valid JSON. The most
common breakage: it's wrapped in a markdown code fence with
explanatory text around it, it has a trailing comma before a
closing bracket, it uses single quotes or unquoted keys like a
JavaScript object literal, it uses Python's True/False/None
instead of true/false/null,
or generation stopped mid-token because it hit a token limit,
leaving a dangling string or bracket. JSON.parse()
rejects all of these outright.
Can it fix JSON that got cut off because the model hit its token limit?
Yes. Truncated output usually ends mid-token, not at a clean syntax boundary, so simply closing the open brackets isn't enough. This tool closes any unterminated string, then trims back the incomplete trailing token (a half-written value or a dangling key with no value yet) until what's left parses as valid JSON.
Does this tool send my data anywhere?
No. Everything runs in your browser — the text you paste is never uploaded, logged, or sent to a server.
Need this in a script or agent pipeline instead of a browser?
The same repair logic is also a small dependency-free CLI/library:
npx github:diwaspoudell/llm-json-repair — see
github.com/diwaspoudell/llm-json-repair.