JSON Repair

FreePrivateHeuristic

Paste almost-JSON: trailing commas, single quotes, unquoted keys, comments, or undefined. The tool produces strict JSON you can parse anywhere.

Broken / lenient JSON
Repaired JSON
Ctrl+Enter Repair

JSON Repair Online

Paste JSON-like text from logs, browser devtools, legacy configs, or copy-pasted API responses. The repair pass applies safe heuristics (comments, trailing commas, single quotes, unquoted keys, undefinednull) and then validates so you get strict JSON you can pipe into any toolchain.

Where Is This Useful?

Logs & devtools
Console output often uses single quotes or omits key quotes. Repair, then validate line/column errors with the JSON Formatter or the invalid JSON guide when the parser still complains.
Config hand-offs
Strip comments and trailing commas before sharing with teams that expect strict JSON or YAML. Convert onward with JSON → YAML when ops wants config files.
CI & strict parsers
Produce spec-compliant JSON for JSON.parse, databases, and OpenAPI examples. After repair, tighten structure with JSON Schema or compare golden files using JSON Diff.

How to Use

  1. Paste lenient JSON in the input panel
  2. Click Repair or press Ctrl+Enter
  3. Copy the repaired output or use the formatter next for pretty-print tweaks

What Gets Fixed (examples)

Trailing comma
{ "a": 1, }
{ "a": 1 }
Single quotes
{ 'b': 'x' }
{ "b": "x" }
Line comment
{ "c": 1 // note
}
{ "c": 1 }

Features

  • Strips // and /* */ comments outside of strings
  • Trailing commas removed before } and ]
  • Single-quoted strings and unquoted keys normalised toward strict JSON
  • undefined rewritten to null
  • Validates repaired output. you only copy when it parses
  • Runs locally; no upload

Frequently Asked Questions

Does JSON allow trailing commas?

Strict JSON does not. This tool removes trailing commas so parsers like JSON.parse accept the output.

Is my data sent to a server?

No. Everything runs locally in your browser.

Will this fix every invalid document?

It handles common lenient patterns. Severely broken syntax may still need manual editing. use the JSON formatter for exact line and column errors.

Related Tools