🔧 JSON Repair Tool

Fix Broken & Malformed JSON Instantly

Paste invalid JSON and get back valid, parseable output in one click. Fixes trailing commas, missing quotes, unquoted keys, single-quoted strings, JS comments, and truncated documents — all free, all in your browser.

Broken JSON Input

How the JSON Repair Tool Works

The JSON repair tool applies a series of targeted heuristic passes to your malformed input. It strips JavaScript-style comments (// and /* */), converts Python literals (True/False/None to true/false/null), replaces single quotes with double quotes, wraps unquoted object keys in quotes, removes trailing commas, and closes any unclosed brackets left by truncated documents.

The result is a clean, standards-compliant JSON string that any JSON parser — from JSON.parse() in the browser to Python's json.loads() or Java's Jackson library — will accept without errors. The repair engine is intentionally conservative: when ambiguity arises it preserves the original value rather than guessing, ensuring the repaired output is a faithful representation of your intent.

Common JSON Errors and When to Use a Repair Tool

The most frequent source of invalid JSON is copying data from JavaScript source code or console output, where trailing commas and unquoted property names are perfectly legal. A JSON repair tool is also essential when working with legacy system exports that embed SQL-style comments, YAML-influenced configuration that uses single quotes, or log aggregation pipelines that occasionally truncate long records. Rather than hunting for the offending character in a 5 000-line payload, paste the entire document here and get a corrected version in milliseconds.

For ongoing data quality, pair the repair tool with the JSON Validator to confirm the output is fully compliant, and the JSON Formatter to pretty-print it for easy reading. Together these three tools cover the complete clean-up workflow for any malformed JSON you encounter in development. For a full walkthrough, read our guides: How to Fix Broken JSON and How to Validate JSON.

Frequently Asked Questions

What types of JSON errors can this repair tool fix?

The JSON repair tool handles the most common malformation patterns: trailing commas after the last array element or object property, missing or unmatched quotation marks around keys and string values, single-quoted strings that should be double-quoted, unquoted property keys (JavaScript object literal style), JavaScript-style single-line (//) and block (/* */) comments, and truncated documents that were cut off mid-value. It recovers as much valid structure as possible from the input.

Why does my JSON have trailing commas and how do I fix them?

Trailing commas appear when JSON is generated by hand or copied from JavaScript code, where trailing commas are permitted in modern syntax. The JSON specification (RFC 8259) does not allow trailing commas, so parsers throw a syntax error. This repair tool strips trailing commas automatically. Paste your JSON, click Repair, and the corrected output is ready to copy — no manual editing required.

Can the tool repair JSON that was cut off or truncated?

Yes. Truncated JSON commonly occurs when reading from log files, API responses with byte limits, or clipboard buffers that silently trim content. The repair engine analyses the unclosed brackets, braces, and string literals and appends the minimum tokens needed to produce a structurally valid document. The repaired JSON preserves all data that was present in the truncated input.

Can this tool convert a Python dict to JSON?

Yes. A common source of "invalid JSON" is data copied straight from Python — which uses True, False, and None instead of JSON's true, false, and null, and often single quotes around keys and strings. Paste your Python dict and the repair tool converts True→true, False→false, None→null, swaps single quotes for double quotes, and quotes bare keys, producing valid JSON you can use anywhere. Note: Python tuples and trailing-comma-free formatting aside, most plain dicts convert cleanly.

Is my JSON data sent to a server when I use this tool?

No. The entire repair process runs locally in your browser using client-side JavaScript. Your JSON data is never transmitted to any server, stored in a database, or logged in any way. This makes it safe to paste sensitive payloads such as API keys, internal configuration, or personally identifiable information without any privacy risk.

What is the difference between JSON repair and JSON validation?

JSON validation checks whether a document is already valid and reports the exact location of any errors — it does not modify the input. JSON repair goes a step further: it analyses the malformed input, applies a set of heuristic fixes, and produces a corrected document. Use the validator first to understand what is wrong; use the repair tool when you want the errors fixed automatically without editing the JSON manually.