← Back to DevKit

JSON Repair

JSON REPAIR · DATA & PROCESS

One-click repair of broken JSON — single quotes, unquoted keys, trailing commas, // and /* */ comments, smart quotes and truncation become valid JSON, with precise locations when unfixable.

Repaired locally — nothing is uploaded.
Broken JSON input
Repaired (valid JSON)
Each toggle controls a repair step: quote normalization fixes single-quoted strings and unquoted keys to standard double quotes and straightens smart quotes; trailing-comma stripping cleans commas before }, ]; comment stripping removes // and block comments; truncation completion closes unfinished strings and brackets when text is cut off. When still unfixable, the exact line and column are reported.

>_ USAGE GUIDE

LLM output, API logs and config files often contain "almost valid" JSON: unquoted keys, single-quoted strings, extra trailing commas, // comments, even truncated text. This tool repairs each class with toggles and returns parseable JSON.

Typical steps:

  1. Paste the broken JSON: drop the text in, all four repair toggles are on by default
  2. Toggle each step: quote normalization (single-quoted strings and unquoted keys to double quotes, smart quotes straightened), trailing-comma stripping, comment stripping, truncation completion — turn any off as needed
  3. Inspect the result: valid JSON appears on the right; open "repaired structure tree" to browse the hierarchy and confirm nothing was altered
  4. Locate failures: if still unfixable, the result turns red and shows the exact "line N · col M" so you jump straight to the source

>_ FAQ

Q1 · Are single-quoted strings converted correctly?

Yes. Only single quotes acting as string delimiters become double quotes; an apostrophe inside a string (e.g. "don't") is preserved, so English contractions are never broken.

Q2 · Are unquoted keys quoted automatically?

Yes. A bare key like { name: "x" } becomes "name", while a , key: shape inside a string value is not misidentified as a key, reducing false edits.

Q3 · How is truncated JSON completed?

With "complete truncation" on, the tool first closes an unfinished string, then closes unclosed { and [ in stack order. It is best-effort — deeply nested or mid-critical cuts may still need a manual fix.

Q4 · Why does it fail after I turn a toggle off?

Each toggle maps to one repair class. Turning off "comment stripping" leaves // in the text (parse error); turning off "trailing-comma stripping" leaves the extra comma. Toggling off is for diagnosing which issue exists — keep all on for the final fix.

Q5 · Does repair change my data?

No. Repair only fixes the syntactic shell (quotes, commas, comments, unclosed brackets); field names and values are untouched — verify with the structure tree.

Embed code

Paste the code below into your page to embed this tool as an iframe (nav and footer auto-hidden).

Heightpx
This tool runs entirely in your browser — input never leaves your device. Press Ctrl K to switch tools anytime.