JSON Repair Online

Paste not-quite-JSON — code fences, trailing commas, single quotes, Python True/False/None — and get valid, pretty-printed JSON back. Everything runs in your browser.

JSON Repair runs entirely in your browser. The JSON you paste — along with any keys, values, or tokens it contains — is fixed on your device and is never uploaded to ArrayKit.

Built and maintained by Udit Agarwal

Open the JSON Formatter

About JSON Repair

JSON Repair takes the not-quite-JSON that language models, logs, and quick hand-edits tend to produce and turns it into valid, pretty-printed JSON. Paste a blob wrapped in ```json code fences, sprinkled with trailing commas, single quotes, unquoted keys, // comments, smart quotes, or Python True/False/None — even one with a missing closing bracket — and get a clean document back. The tool strips the surrounding Markdown fences first, repairs the syntax, then re-parses and re-indents so the result is guaranteed to parse. A short summary shows what was changed — trailing commas removed, single quotes converted, keys quoted — so nothing is fixed silently. It is built for anyone wiring up an LLM pipeline, debugging an API response, or salvaging a truncated payload. Every repair happens locally in your browser; the text you paste never leaves your device.

Features

  • Strips ```json and plain ``` Markdown code fences that wrap model output
  • Removes trailing commas from objects and arrays
  • Converts single quotes and curly smart quotes to valid double quotes
  • Adds double quotes around unquoted object keys
  • Rewrites Python True, False, and None as JSON true, false, and null
  • Drops // line and /* block */ comments and closes truncated brackets
  • Summarizes every fix applied, or notes when the input was already valid
  • Pretty-prints with 2-space, 4-space, or tab indentation, then copies or downloads .json

How to use the JSON Repair

  1. Paste the broken or LLM-generated JSON into the input box
  2. Read the repaired, pretty-printed JSON in the output pane on the right
  3. Check the fix summary to see what changed — fences, commas, quotes, or literals
  4. Pick 2-space, 4-space, or tab indentation to match your project style
  5. Copy the result or download it as a .json file

Example

Input

{ name: 'Ada', active: True, roles: ['admin', 'author',] }

Output

{
  "name": "Ada",
  "active": true,
  "roles": [
    "admin",
    "author"
  ]
}

An unquoted key, single quotes, Python True, and a trailing comma are all repaired.

Common errors & troubleshooting

  • The output says 'Could not repair this input.' — The text is too far from JSON to recover. Confirm you pasted the data blob itself — not a surrounding sentence, a log prefix, or two separate objects mashed together.
  • A truncated reply comes back with null values I did not expect. — When the input is cut off mid-value, the repair closes the open brackets and fills the dangling key with null. Re-run with the complete payload if you have it.
  • My // and /* */ comments are gone from the repaired JSON. — JSON does not allow comments, so they are stripped. Move any notes into a real string field before repairing if you need to keep them.
  • NaN, Infinity, or a number with a leading zero is rejected or altered. — None of those are legal JSON. Quote them as strings first if you need to preserve the original text exactly.

Frequently asked questions

What kinds of broken JSON can this repair?
Code fences, trailing commas, single and smart quotes, unquoted keys, // and /* */ comments, Python True/False/None, and missing closing brackets. It handles the loose output LLMs and log lines tend to emit, then re-parses so the result is valid.
Does it fix the JSON that ChatGPT or Claude return wrapped in code fences?
Yes. The tool strips the surrounding ```json (or plain ```) Markdown fence first, then repairs whatever is inside. A lone opening fence from a truncated reply is removed too.
Will repairing change my data or just the syntax?
Only the syntax and formatting change; your keys and values are preserved. The one exception is a truncated input, where a dangling key may be filled with null so the document can close and parse.
Can it convert Python-style dicts with True, False, and None?
Yes. Python's True, False, and None become JSON true, false, and null, and single-quoted strings and keys are converted to double quotes, so a pasted Python dict comes out as valid JSON.
What happens if the JSON is cut off or truncated mid-way?
The repair closes any open objects and arrays and fills an incomplete key with null. It is a best-effort rescue — inspect the fix summary and re-run with the full payload when you can.
Does the repaired JSON keep my key order and chosen indentation?
Key order is preserved as written. You choose 2-space, 4-space, or tab indentation, and the output is re-parsed and re-serialized so it is guaranteed to be valid JSON.

Related tools

  • JSON Formatter — Beautify, minify and validate JSON with error locations.
  • JSON Diff — Compare two JSON documents and see a structural, key-order-independent diff.
  • JSON Escape / Unescape — Escape text into a JSON string or unescape a JSON string back to raw text.
  • JSON Viewer — Text + collapsible tree viewer with expand/collapse and node paths.
  • NDJSON to JSON — Convert NDJSON / JSON Lines to a JSON array and back, line by line.
  • JSON Patch Generator — Generate an RFC 6902 JSON Patch between two JSON documents and apply a patch to a source.

Guides

More JSON tools

  • JSON to GraphQL Schema — Generate GraphQL SDL types from a JSON sample, inferring fields and nested types.
  • JSON to SQL — Turn a JSON array into CREATE TABLE and batched INSERTs with inferred column types.
  • JSON Formatter — Beautify, minify and validate JSON with error locations.
  • JSON Tree Viewer — Explore JSON as a collapsible, typed tree.
  • JSON Viewer — Text + collapsible tree viewer with expand/collapse and node paths.
  • JSON to TypeScript — Generate TypeScript interfaces from a JSON sample.
  • JSON to CSV — Convert an array of flat JSON objects to CSV.
  • JSON Escape / Unescape — Escape text into a JSON string or unescape a JSON string back to raw text.
  • JSON to Code — Generate Go, Rust, Python, Java, Kotlin, C# and TypeScript types from JSON.
  • JSON Diff — Compare two JSON documents and see a structural, key-order-independent diff.
  • JSON Schema Generator & Validator — Generate a JSON Schema from a sample or validate JSON against a schema.
  • JSON Flatten / Unflatten — Flatten nested JSON to dot-notation keys, or unflatten it back.

See all JSON tools (29) · All tools