JSON Fixer
Automatically repair malformed, corrupted, or non-strict JSON. Fixes trailing commas, single quotes, unquoted keys, missing brackets, and other common syntax issues. Displays a detailed log of every fix applied.
JSON Fixer & Automatic Repair Tool
Paste malformed, corrupted, or non-strict JSON and automatically repair common syntax issues.
How to Use the JSON Fixer and Automatic Repair Tool
A developer copies a JavaScript object literal from source code to paste into a configuration file. The object has trailing commas after the last array element and single-quoted property names, which are valid JavaScript but invalid JSON. Paste the broken JSON into the input panel and click Fix and Format. The tool detects trailing commas, swaps single quotes for double quotes, wraps unquoted keys, and balances missing brackets. The repair log shows exactly what was changed: three fixes applied. Copy the fixed output and paste it into the configuration file.
An engineer debugging a production issue has a partial API response that was cut off mid-transmission by a network timeout. Paste the truncated JSON, click Fix and Format, and the bracket balancer appends the missing closing braces and brackets. While the tool cannot recover the truncated data, it produces parseable JSON that reveals most of the structure and available fields for debugging.
A systems administrator converts relaxed JSON configuration files that use unquoted keys, single quotes, or trailing commas into strict RFC 8259 JSON. Paste the legacy config, click Fix and Format, and the repair pipeline normalises quotes, strips trailing commas, and wraps bare identifier keys in double quotes. The repair log documents every transformation for auditability.
A developer copies output from console.log in Node.js, which uses single quotes for string values and may include trailing commas in object literals. Paste the console output, click Fix and Format, and the tool converts it to valid JSON. This is faster than manually editing every string quote and removing commas by hand.
A non-technical team member edits a JSON file manually in a text editor and accidentally introduces a trailing comma or forgets a closing bracket. Paste the broken JSON, click Fix and Format, and the repair pipeline fixes the syntax automatically. The repair log provides transparency into what was changed so the team member can understand what went wrong.
How the JSON Repair Pipeline Works
You paste JSON that has syntax errors β trailing commas, single quotes, unquoted keys, or missing brackets. The tool runs a four-stage repair pipeline, each stage targeting one category of error. Every stage is context-aware, meaning it tracks whether it is inside a string literal to avoid corrupting actual data values.
Quote Normalisation and Trailing Comma Removal
The first stage scans for single quotes that appear outside of double-quoted strings and replaces them with double quotes. It respects backslash escapes so contractions inside string values like don't are left alone. The second stage looks for commas immediately before closing braces or brackets and removes them. This handles the most common syntax error: trailing commas after the last element in an array or object, which JavaScript and Python allow but JSON does not.
Unquoted Key Wrapping and Bracket Balancing
The third stage detects bare identifier tokens that follow opening braces or commas β property names like name or age that are missing their quotes β and wraps them in double quotes. The fourth stage uses a stack-based algorithm to count unmatched opening braces and brackets, then appends the missing closing delimiters in reverse order. This fixes truncated documents where the final closing bracket was accidentally deleted.
Frequently Asked Questions
What types of JSON errors can it fix?
The tool handles four common categories: single quotes instead of double quotes, trailing commas after the last element, unquoted property names, and missing closing brackets or braces. If the JSON is fundamentally malformed β for example, entirely non-JSON text or missing most of its content β the pipeline will report the remaining error after attempting all repair stages.
Will the repair change any of my actual data values?
No. The repairs only target syntax errors. String values, numbers, booleans, and nested structures are never modified. The quote normaliser specifically avoids touching single quotes that appear inside double-quoted strings, so contractions like "don't" or "it's" are preserved exactly as they appear in the original.
Why do trailing commas keep appearing in my JSON?
Many programming languages β including JavaScript, Python, and TypeScript β allow trailing commas in object and array literals. When developers manually edit JSON files or copy data from these languages, trailing commas often sneak in. JSON per RFC 8259 strictly forbids them, which is why most APIs and parsers reject files with trailing commas.
What if the tool wraps the wrong tokens in quotes?
The key wrapper uses a conservative heuristic: it only targets tokens that look like valid JavaScript identifiers (alphanumeric characters, underscores, dollar signs, no spaces) and are not already wrapped in quotes. Numeric-only keys or keys with special characters may require manual correction. Always review the repair log to confirm each transformation matches your intent.
Can it fix truncated JSON from a network timeout?
Partially. The bracket balancer appends the missing closing braces and brackets so the document becomes parseable. However, the tool cannot recover the truncated data itself β if a response was cut off mid-transmission, the last few fields are lost. The repaired output gives you most of the structure and available data for debugging purposes.