Skip to content
{}

JSON Fixer

Repair almost-JSON: trailing commas, single quotes, unquoted keys, comments, and Python literals.

0 chars | 1 lines
0 chars | 0 lines

Conversion payloads stay in this browser tab and are never placed in page URLs - see how local processing works. Privacy-safe analytics record only the tool, outcome, and a coarse input-size bucket.

How to Repair JSON

Paste the text that failed to parse. The fixer walks the input once while tracking string context, so a comma or comment marker inside a string value is never mistaken for syntax. It then reparses the result to confirm the repair actually produced valid JSON before returning it - if it did not, you get the remaining parse error instead of broken output.

Repairs Applied

Each row shows the input pattern and what it becomes.

InputOutputNote
{a: 1}{"a": 1}Unquoted key
{'a': 'b'}{"a": "b"}Single quotes
[1, 2, 3,][1, 2, 3]Trailing comma
{"a": None}{"a": null}Python literal
{"a": NaN}{"a": null}Not valid JSON
// note\n{}{}Comment stripped

Repair, Then Validate

A repaired document is worth reviewing rather than trusting. Read the list of changes, confirm each one matches what you meant, and then keep the fixed file as the source of truth so the same paste does not need repairing again. If you only need to know why a document fails, the JSON validator reports the error location without modifying anything.

Frequently Asked Questions

What can it repair?

Trailing commas, single-quoted strings, unquoted object keys, // and /* */ comments, Python's None, True, and False, JavaScript's undefined, NaN and Infinity, curly "smart" quotes from a document editor, a leading module.exports or const x = wrapper, literal newlines and tabs inside strings, and a stray leading + on a number.

What can it not repair?

Anything that needs a human decision: missing brackets, missing commas between two values, and truncated documents. Guessing where a document was cut off would produce output that parses but no longer means what the source meant, so the tool reports the failure instead.

How do I know what was changed?

Every repair is listed in a Conversion notes panel beside the result, with a count where a fix was applied more than once. The output box itself stays valid JSON you can copy straight out, and if the input was already valid the tool says so rather than implying it repaired something.

Why does my JSON have single quotes in the first place?

Because it usually is not JSON. Python dicts printed to a terminal, JavaScript object literals copied from source, and Ruby hash output all look like JSON but use the host language's syntax. That is the most common reason a paste fails to parse.

Related Tools