JSON Repair

Paste broken JSON and get valid JSON back. Fixes trailing commas, single quotes, unquoted keys, missing commas, comments, Python literals, and truncated LLM output — locally in your browser; nothing is uploaded.

Try:
Repaired JSON

Fix broken JSON in one paste

Copied JSON out of a log file, a JavaScript source, a Python print, or an LLM answer and your parser rejects it? Paste it above and this tool rebuilds it as valid JSON. It is a tolerant parser, not a find-and-replace: the input is re-parsed token by token and re-serialized, so the output is always syntactically valid JSON. Everything runs locally in your browser — nothing is uploaded.

What it fixes

Worked example

Input:

{'name': 'John', age: 30, // legacy record
 tags: ['admin' 'ops'],}

Repaired output (2-space indent):

{
  "name": "John",
  "age": 30,
  "tags": [
    "admin",
    "ops"
  ]
}

Limits and edge cases

FAQ

Why is my JSON invalid in the first place?

The most common causes are hand-edited config files (trailing commas, comments), data pasted from JavaScript or Python source (single quotes, unquoted keys, True/None literals), word-processor pastes (curly “smart” quotes), and LLM answers that were cut off mid-response or wrapped in a markdown code fence. All of those are exactly what this tool repairs.

Can it fix truncated JSON from an LLM response?

Yes. If the response was cut off mid-string, mid-array, or mid-object, the repair closes every unclosed string, array, and object at the end of the input, and a dangling "key": becomes "key": null. It also strips the ```json fence and any prose around it first. What it cannot do is invent the data that was never generated — the repaired document contains only what actually arrived.

Does repairing change my data?

Values that already parse are kept exactly (key order included). Repairs only normalize syntax: quoting style, separators, comments, and literal spellings. Three genuine conversions happen because JSON has no equivalent: NaN/Infinity/undefined become null, duplicate keys collapse to the last value, and oversized integers become floats. Everything runs locally; the text never leaves your machine.

How is this different from a JSON validator or beautifier?

A validator points at the first syntax error and stops; a beautifier re-indents JSON that is already valid. This tool accepts input those reject, repairs every issue it finds in one pass, and then formats the result with the indentation you chose (2/4 spaces, tabs, or minified).

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool json-repair "{'name': 'John', age: 30,}"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/json-repair/?json=%7B%27name%27%3A%20%27John%27%2C%20age%3A%2030%2C%7D&indent=2

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.