Repair malformed JSON and review what the repair inferred
JSON Repair proposes a valid document from text with common syntax mistakes. It is useful for recovering a draft copied from logs, JavaScript examples, or truncated output.
When should you use it?
- Fix unquoted names and single-quoted values.
- Remove comments or trailing commas from an example.
- Recover a partially written object for manual review.
Example: review a repair suggestion
Repair proposes syntax changes. Inspect the meaning of every value before using the result.
{name: 'Alex', active: true,}{"name":"Alex","active":true}A repair is a proposal about the intended text
A repair library can often add missing quotes, remove a trailing comma, or close an unfinished container. It cannot know the value a producer intended to send. A truncated response may be made syntactically valid while still missing records. Keep the original input and read the repaired output before using it as a source of truth.
Fix the producer when the same error returns
Repair is useful for recovering a pasted example or investigating a damaged export. Repeated repairs in a data pipeline can conceal a serialization bug. Once you identify the cause, correct the generator or response handling and validate its output. If the file intentionally uses comments and trailing commas, JSONC to JSON is the more explicit conversion for that format.
Recover a usable draft from broken JSON.
Repair can add missing quotes or commas, remove comments or trailing commas, and recover some incomplete structures. The result is a suggestion to inspect, not proof of the intended data.
Paste the broken text
The input is preserved throughout repair.
Generate a suggestion
jsonrepair proposes changes; the strict validator checks the result.
Review before using
Copy the result or open it in the JSON editor only after inspecting it.
How do I repair JSON with single quotes, comments, or a trailing comma?
Paste the JSON-like text into Repair and generate a suggestion. Compare each change against your intended data before exporting. The tool can fix common punctuation and quoting mistakes, but it cannot know a value that was never present in the source.
JSON-like input and suggested strict JSON
textInput: {name: 'Alex', active: true,}
Possible: {"name":"Alex","active":true}The input line is deliberately invalid JSON. The output is a proposal that should be checked with the original source or a schema.
Should I repair every invalid API response automatically?
No. Repair may infer missing punctuation or content and change meaning. For production contracts, find and fix the producer; use the Validator to diagnose errors without modifying data.
What should you check before using the result?
Missing data has no knowable intended value. A repair may infer or change meaning, so inspect names, numbers, array length, and strings before using it. For diagnosis without changes, use Validator.
Repair has limits
No library can know the intended value of text that is missing. Truncated arrays, incomplete strings, or JavaScript-like values may need assumptions. Check key names, numbers, and item counts before using a repaired response in another system.
Validating is different from repairing
The syntax validator reports errors without modifying data. This tool intentionally attempts changes, using jsonrepair in a worker. It never executes pasted JavaScript and never loads referenced URLs. A repair that still fails strict JSON validation is not exported.
Technical reference: JSON syntax and interoperability · RFC 8259