JSON Repair

Fix broken JSON — trailing commas, comments, single quotes, unquoted keys — 100% in your browser, no upload

🔒 Runs in your browser — nothing is uploaded.

What is JSON Repair?

JSON Repair takes malformed or near-JSON text and rewrites it as strict, valid, pretty-printed JSON. It fixes the breakages people paste every day: trailing commas, // line and /* block */ comments, single-quoted strings, unquoted keys, and raw JavaScript object literals.

How is it different from a JSON formatter?

A formatter assumes your input is already valid and only re-indents it. JSON Repair assumes the input is broken and recovers it first, then formats — so it succeeds on the messy JSON you get from logs, config files, and LLM chat responses.

What is not JSON, and why your file has it anyway

JSON is a much smaller language than it looks. Keys must be double-quoted strings; there are no trailing commas, no comments, no single quotes, no NaN or Infinity, no hex numbers, no leading +, and no undefined. Every one of those is legal in a JavaScript object literal, which is why text copied out of a source file, a console or a config so often fails to parse — it was never JSON, it was JavaScript that resembles it. Python adds its own near-misses: True, False and None.

Repair is a guess, and some guesses are dangerous

Fixing quotes and dropping trailing commas is safe: the intent is unambiguous. Closing an unclosed bracket is not — a file truncated mid-transfer is missing content, and adding a } produces something that parses while quietly meaning less than the original did. Numbers are the sharpest edge: JSON has one number type and parsers read it as a double, so an ID beyond 2⁵³ loses its last digits before any repair has a chance to run. If the values matter, always diff the repaired output against the source rather than trusting that a parse means a correct read.

Frequently asked questions

What kinds of broken JSON can it fix?

Trailing commas, // line and /* block */ comments, single-quoted strings, unquoted or JavaScript-style keys, and full JS object literals. It also strips ```json code fences so you can paste output straight from an LLM chat.

Is my data uploaded anywhere?

No. Everything runs locally in your browser using JSON5 — your JSON never leaves your device.

Why does my JSON with comments fail?

Because JSON has no comments — neither // nor /* */. What you have is JSONC or JSON5, which several tools accept and the standard parser does not.

Can it recover a truncated file?

No. A cut-off file does not parse, so it is refused with the line and column where reading stopped. The tool does not add the missing brackets, because that would give JSON that parses while meaning less than the original; go back for the whole file.

My large numbers changed. Why?

JSON has a single number type and parsers read it as a 64-bit float, which holds integers exactly only up to 2^53. Longer IDs lose their tail. The fix is on the producing side: send them as strings.