JSON Toolbox LogoJSONToolbox

JSON Repair

Repair broken or invalid JSON in your browser. Fix trailing commas, single quotes, unquoted keys, missing brackets, comments, and Python constants, then copy or download valid JSON without uploading your data.

Repaired JSON will appear here...
Indent
All processing happens in your browser. No JSON is sent to our servers.

Key Features

Fix Common JSON Errors

Repair JSON with trailing commas, single quotes instead of double quotes, unquoted object keys, and missing closing brackets. The tool applies best-effort fixes and returns valid JSON when the structure can be recovered.

Strip JSON Comments

Remove single-line (//) and block (/* */) comments from JSON-like input. Comments are not valid standard JSON, so they are stripped before the result is serialized.

Normalize Quotes

Convert single quotes to double quotes and normalize smart quotes (“ ” ‘ ’) to straight quotes. Unquoted object keys are wrapped in double quotes so the document parses.

Handle Python and JS Constants

Convert Python constants such as True, False, and None, plus common JavaScript values such as NaN and Infinity, into valid JSON values when they appear in the input.

Validate After Repair

The repaired output is parsed to confirm it is valid JSON before it is shown. If the document cannot be recovered, the tool reports an error instead of returning a partial or misleading result.

Copy or Download

Copy the repaired JSON to your clipboard or download it as a .json file for use in APIs, configuration, tests, or other development workflows.

Paste or Open JSON

Paste broken JSON into the input or open a local file. The repair runs in your browser, so the source text is not uploaded to a server.

Browser-Based Processing

Repair, validation, and formatting happen in your browser. The page does not require an account or send your JSON to a remote service.

How to Use

1

Paste broken JSON

Paste invalid JSON into the input field, or open a local .json file. The page accepts documents with trailing commas, single quotes, unquoted keys, comments, or missing brackets.

2

Repair the input

Click Repair JSON. The tool attempts best-effort fixes and parses the result. If the document can be recovered, valid JSON is produced; otherwise an error is reported.

3

Review the valid output

Check the repaired JSON in the output panel. Use the indent selector to switch between 2 spaces, 4 spaces, or a tab for the displayed result.

4

Copy or download

Copy the repaired JSON or download it as a .json file. Validate it with a JSON schema validator before using it in production if the data is important.

JSON Repair Example

Recover an invalid JSON document that uses comments, single quotes, unquoted keys, and a trailing comma.

Broken JSON
// user record
{
  name: 'Alice',
  age: 28,
  active: True,
  tags: ['admin', 'user',],
}

This document is not valid JSON: it has a // comment, single-quoted strings, an unquoted key, a Python True, and a trailing comma before the closing bracket.

Repaired JSON
{
  "name": "Alice",
  "age": 28,
  "active": true,
  "tags": [
    "admin",
    "user"
  ]
}

The repair strips the comment, converts quotes and the key, maps True to true, removes the trailing comma, and produces valid, parseable JSON.

Repair is best-effort. It cannot invent missing data, so a document that is too structurally broken may still fail to repair.

How to Repair Invalid JSON Online

What Is JSON Repair?

JSON repair is the process of turning invalid JSON into valid, parseable JSON. Real-world JSON often breaks because of copy-paste from code, exported configuration, or REPL output. A JSON fixer applies best-effort corrections so the document can be parsed again.

Common JSON Errors This Tool Fixes

  • Trailing commas: a comma before a closing } or ] is removed.
  • Single quotes: strings written with single quotes are converted to double quotes.
  • Unquoted keys: object keys without quotes are wrapped in double quotes.
  • Missing brackets: unclosed { or [ are closed when the structure allows it.
  • Comments: // and /* */ comments are stripped.
  • Python and JS constants: True, False, None, NaN, and Infinity are mapped to valid JSON.

How to Repair Broken JSON

  1. Paste the broken JSON: include comments, single quotes, or trailing commas if present.
  2. Repair: the tool applies fixes and parses the result.
  3. Review: confirm the output is valid JSON and adjust the indent if needed.
  4. Copy or download: use the repaired document in your workflow.

Repair vs Format

Repair fixes syntax so the document becomes valid JSON. Formatting, by contrast, only changes indentation and spacing of JSON that is already valid. Use repair first; if you only need readable spacing on valid JSON, a formatter is enough.

Limits of JSON Repair

JSON syntax error fix is best-effort. It cannot invent missing data or recover a document whose structure is fundamentally wrong. If the input is too broken, the tool reports an error rather than returning a misleading result. After repair, validate important data with a JSON schema validator before using it in production.

Privacy

Repair runs entirely in your browser. Your JSON is not uploaded, and no account is required. Do not paste passwords, tokens, or production credentials into any online tool.

Related Articles

Related Tools

Frequently Asked Questions

What does JSON repair do?

JSON repair takes invalid JSON and applies best-effort fixes so the result is valid, parseable JSON. In short, it helps you fix JSON that other tools reject. It addresses common problems such as trailing commas, single quotes, unquoted keys, missing closing brackets, comments, and Python or JavaScript constants.

Can it fix invalid JSON?

It can fix invalid JSON when the structure can be recovered. It cannot invent missing data or guess an entirely wrong structure. If the input is too broken, the tool reports an error instead of returning a misleading result.

Does it remove comments from JSON?

Yes. Single-line (//) and block (/* */) comments are stripped, because comments are not part of standard JSON. If you specifically need JSON with comments, use a JSONC tool instead.

Does it change my data values?

Repair changes syntax, not your values. String contents, numbers, and structure are preserved. Constants such as Python True/False/None are mapped to their JSON equivalents true/false/null so the document becomes valid.

How are single quotes and unquoted keys handled?

Single quotes are converted to double quotes, and unquoted object keys are wrapped in double quotes. Smart quotes are also normalized to straight quotes so the document parses.

Can it handle Python or JavaScript constants?

Yes. Values such as True, False, None, NaN, and Infinity are converted to valid JSON values when they appear in the input. This is useful when pasting output from a Python or Node.js REPL.

Is my JSON data safe?

Yes. Repair, validation, and formatting run in your browser. Your JSON is not uploaded to a server and no account is required. Avoid pasting secrets such as passwords, tokens, or production credentials into any online tool.

What if repair fails?

If the document cannot be recovered, the tool shows an error instead of producing partial output. Review the source for missing or duplicated structural characters, then try again.

Is this a free JSON repair tool?

Yes. You can repair JSON, review the result, copy it, or download it without creating an account.