Guides Knowledge Base

Fix JSON Online: Repair Invalid JSON

Fix invalid JSON online. Get the exact line and column of every syntax error, plus the correction for trailing commas, single quotes and unquoted keys.

Repairing JSON means finding the character that broke the parse and correcting it. Paste the broken document and the validator reports the exact line and column where parsing stopped, so you can fix the fault rather than guess at it.

The Five Faults Behind Most Broken JSON

  1. Trailing comma — {"a": 1,} or [1, 2,]. Delete the comma before the closing bracket.
  2. Single quotes — {'a': 1}. Replace every ' around keys and string values with ".
  3. Unquoted key — {a: 1}. Wrap the key in double quotes.
  4. Comment — // note or /* note */. Remove it, or switch the file to JSONC, JSON5, or YAML.
  5. Unclosed bracket or quote — reported as an unexpected end of input. Count openers against closers from the reported line upward.

Repair Workflow

  1. Paste the broken JSON. Note the reported line and column.
  2. Fix that one character. Do not fix ahead — a parser stops at the first fault, so later errors are still hidden.
  3. The check re-runs as you type. Repeat until the status reads valid.
  4. Send the repaired document through the JSON Formatter to normalise indentation.

Smart Quotes and Invisible Characters

Text copied out of a word processor, a chat client, or a PDF often carries typographic quotes (“ and ”) that look correct but are not U+0022. A byte-order mark at the start of a file and a non-breaking space between tokens fail the same way. When the reported column looks like it points at valid text, one of these is usually why.

Who this guide is for

  • Repair a config file after a hand edit introduced a trailing comma
  • Diagnose a payload truncated by a network timeout
  • Fix JSON copied out of a document that replaced quotes with smart quotes
  • Locate the unclosed bracket in a deeply nested file

Try the free JSON Validator

Runs entirely in your browser — no upload, no signup, and your data never leaves your device.

Open JSON Validator

Frequently Asked Questions

Does this tool repair JSON automatically?

No — it diagnoses rather than rewrites. Automatic repair has to guess your intent, and a wrong guess silently changes data. You get the exact fault location and the correction to apply.

Can truncated JSON be recovered?

Partially. If a response was cut off mid-document you can close the open brackets to make it parse, but the missing records are gone — re-fetch the source when the tail matters.

My JSON has comments. How do I fix that?

RFC 8259 has no comments. Strip them for strict JSON, or keep the file in a format that allows them: JSONC (used by VS Code settings), JSON5, YAML, or TOML.

Tools mentioned in this guide

Related JSON Topics & Reference Articles