Skip to content
Tools

JSON Fixer (Repair Invalid JSON)

Last updated:

Paste JSON that a parser rejects and press Auto-fix to get valid JSON back. Each repair is listed and shown as a before-and-after diff, and nothing is applied until you confirm.

Repairs are computed in your browser; broken configs and logs are never uploaded. How we protect your data

Input

Loading editor…

Paste JSON here

or drop a .json file anywhere in this box. Everything stays in your browser.

Output

Paste JSON to see it as a table.
Loading editor…
Paste JSON, drop a file, or try the sample.

How to use the json fixer

  1. Paste the broken JSON.
  2. Press Auto-fix or Ctrl/Cmd+Alt+F.
  3. Read the list of repairs and the highlighted diff; anything that could change meaning is marked for review.
  4. Apply the fix. Ctrl/Cmd+Z in the editor undoes it.
  5. Copy the now-valid JSON with Ctrl/Cmd+Alt+C.

Features

  • Review before apply: Every repair is listed and diffed; there are no silent edits.
  • Syntax-only repairs: Changes punctuation and literals, never your keys or string contents.
  • Missing brackets: Closes unterminated objects and arrays at the end of truncated input.
  • Honest limits: If a repair would require guessing your intent, it is reported instead of applied.

Example

JavaScript-style config → valid JSON

Input

{name: 'Ada', active: True, // note
 tags: ['x',],}

Output

{"name": "Ada", "active": true, "tags": ["x"]}

Five kinds of repair: three unquoted keys quoted, single quotes converted, True → true, the // comment removed, and two trailing commas removed.

What Auto-fix repairs

What Auto-fix repairs
ErrorCauseFix
Trailing commaComma after the last item, common in hand-edited files.Removed.
Single-quoted string'value' copied from JavaScript or Python.Converted to "value", inner quotes escaped.
Unquoted keyJavaScript object literal syntax.Key wrapped in double quotes.
// and /* */ commentsJSONC config files such as tsconfig.json or VS Code settings.Removed.
True / False / NonePython repr or print() output.Converted to true / false / null.
undefined, NaN, InfinityJavaScript values with no JSON equivalent.Converted to null and flagged for review.
Raw newline in a stringMulti-line text pasted into a value.Escaped as \n.
Missing } or ]Truncated copy or log line.Appended at the end; check that no data was lost.

What the fixer will not guess

Some broken JSON has more than one plausible repair. A missing comma in the middle of a long array, an unclosed string that swallowed the next ten lines, or two objects pasted back to back could each be fixed several ways. In those cases the fixer stops, shows the remaining error with its line and column, and leaves the decision to you.

Python values with no JSON form, such as tuples, sets, datetime(...) or bytes literals, are also reported rather than invented.

Tips

  • Fixing tsconfig.json or .vscode/settings.json? Those files are JSONC by design; keep the original with comments and only fix copies you send to strict parsers.
  • After applying a fix to truncated input, compare item counts in the tree view with what you expected.

JSON Fixer FAQ

How do I fix invalid JSON automatically?

Paste it here and press Auto-fix. You see each proposed change before anything is applied.

Can it fix JSON with single quotes?

Yes. Single-quoted strings and keys are converted to double quotes, and any double quotes inside the text are escaped.

How do I convert a Python dict to JSON?

Paste the printed dict. True, False and None become true, false and null, and single quotes are converted. In code, json.dumps(obj) is the reliable way.

Will the fixer change my values?

It changes syntax, not data. Where a fix could alter meaning, such as converting NaN to null or closing a truncated array, it is flagged.

Why not just use JSON5 or a lenient parser?

Because the system receiving your data almost always expects strict JSON. Fixing the text gives you something any parser will accept.

Can I undo an auto-fix?

Yes. Press Ctrl/Cmd+Z in the editor right after applying to restore the original text.

Related tools