Fix Invalid JSON Online — Auto-Repair Tool

Load example:

Broken JSON

Paste your broken or invalid JSON here

Repair Result

Applied fixes & repaired output

What gets auto-fixed

  • Trailing commas before } or ]
  • Single quotes → double quotes
  • Python: True / False / None → true / false / null
  • JavaScript: undefined → null
  • Unquoted object keys
  • Single-line and block comments (// and /* */)
  • Hexadecimal number literals
  • NaN and Infinity values

Paste broken JSON and click Fix

Repairs 8+ common syntax issues automatically

Fix JSON Errors

How to Use

  1. 1Paste your broken or invalid JSON into the input area — even if it's a mix of JavaScript, Python, or hand-written data.
  2. 2Use the 'Load example' presets at the top to see common broken JSON patterns before testing your own.
  3. 3Click 'Fix JSON Errors' to automatically apply all detected repairs.
  4. 4The 'Fixes Applied' panel lists every change made with a count (e.g., 'Removed trailing commas ×3').
  5. 5A green banner means the output is now valid, parseable JSON. A yellow banner means some errors remain and manual editing is needed.
  6. 6Copy the fixed output or use it directly in your project.

Practical Applications

1

Python dict to JSON

Python dictionaries look like JSON but use True, False, None, and single quotes. Paste a Python dict and fix it to valid JSON in one click.

2

JSONC / JSON with Comments

Configuration files like tsconfig.json, .eslintrc, or VS Code settings use JSON with comments. Strip comments to get clean, parseable JSON.

3

Hand-Written JSON Repair

Manually typed JSON often has trailing commas (forgetting JSON is stricter than JS) or unquoted keys. Auto-fix these common mistakes instantly.

4

Fixing Copied JSON Snippets

JSON copied from Stack Overflow, blog posts, or code reviews often has JavaScript-style syntax. Fix it before using it in production code or APIs.

5

Database Export Cleanup

Some database tools export JSON-like formats with non-standard syntax. Use the fixer to normalize them before importing to other systems.

Frequently Asked Questions

QWhat JSON errors can be auto-fixed?

The tool automatically repairs: trailing commas before } or ], single quotes → double quotes, Python True/False/None → true/false/null, JavaScript undefined → null, unquoted object keys, single-line comments (//), block comments (/* */), hexadecimal number literals, and NaN/Infinity values.

QWhat errors can't be auto-fixed?

Structural errors like completely missing brackets, deeply malformed nesting, or binary/non-text content cannot be auto-repaired. The tool will show which fixes it applied and indicate if errors remain after repair.

QCan I fix JSON that came from Python?

Yes — Python's dict repr is one of the most common broken-JSON patterns. The fixer converts True→true, False→false, None→null, and single-quoted strings to double-quoted strings, which covers the vast majority of Python dict outputs.

QWill the fixer change my data?

No data values are changed — only syntax is corrected. Key names, string content, numbers, and nesting structure are preserved exactly. The only exception is that NaN and Infinity (which have no JSON equivalent) are replaced with null.

QWhat should I do if the fixer can't fully repair my JSON?

Check the 'Fixes Applied' list to see what was already repaired, then use the JSON Validator to get the exact line/column of the remaining error and fix it manually in the output.