JSON Repair

Input
Output

Repair Invalid JSON

Got JSON that will not parse? Bracely Repair fixes the mistakes people and tools make most often and tells you what it changed, so you can trust the result.

Example: a config pasted from an old service, cut off at the end

A comment, single quotes, unquoted keys, Python's True and None, a trailing comma, and a string and an object that never close because the copy was cut off. All 17 problems are fixed; the two closings at the end are marked as guesses to check:

Input

{
  // order from the old service
  'id': 'ORD-20419',
  paid: True,
  coupon: None,
  items: [
    {sku: 'KB-01', qty: 1,},
    {sku: 'MS-02', qty: 2}
  ],
  "note": "cut off her

Output

{
  "id": "ORD-20419",
  "paid": true,
  "coupon": null,
  "items": [
    {
      "sku": "KB-01",
      "qty": 1
    },
    {
      "sku": "MS-02",
      "qty": 2
    }
  ],
  "note": "cut off her"
}

How do I use the JSON Repair?

  1. Paste the broken JSON.
  2. Bracely repairs it and lists every fix it made.
  3. Copy the valid JSON, or carry it straight into any other tool.

What does the JSON Repair do?

  • Removes comments and trailing commas, and adds missing commas
  • Turns single quotes into double quotes and quotes bare keys
  • Converts Python and JavaScript values such as True, None, NaN and undefined
  • Closes JSON that was cut off part way through

When to use the JSON Repair

JSON breaks in predictable ways: a config with comments, a value copied from Python or JavaScript, a log line cut off at a size limit, an AI model's answer with a trailing comma, or a hand-edited file with a missing quote. JSON.parse only says where it gave up; Repair fixes the whole thing and tells you what it did.

It removes comments and trailing commas, adds missing commas, turns single quotes into double quotes, quotes bare keys, converts True, False, None, NaN and undefined, and closes strings, arrays and objects that never end. Show: what changed lists every fix with its line and column, and separates safe fixes from guesses to check, such as where a cut-off string was closed.

Frequently asked questions

What are the guesses to check?
Fixes where Bracely had to assume something, usually at the end of cut-off input: where an unfinished string ends or which brackets close. The data before that point is exact; check the end against the source.
Is the repaired JSON the same data?
Everything that could be read is kept as it was; only the syntax changes. NaN and undefined become null because JSON has no such values, and anything after a cut-off is simply missing.
What kinds of errors can it fix?
Comments, single quotes, unquoted keys, trailing or missing commas, Python values like True and None, and cut-off endings.
Will it change my data?
Only what it needs to make the JSON valid, and it lists each change so you can check.
Can it fix JSON from a log or a Python print?
Usually, yes. Python dict output and JavaScript object literals are among the most common inputs it repairs.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram