JSON Repair

Runs 100% in your browser

Repair broken JSON in your browser with conservative, transparent fixes for trailing commas, comments, single quotes, and bare keys — review every change, export only when valid.

Only enabled rules are attempted — no data is silently discarded.
INPUT

Broken or non-standard JSON

Waiting
0 characters — 0 bytes Not checked
REPAIRED OUTPUT

Review before export

Your repaired JSON will appear here.
0 bytes

Repair report

No fixes yet

Run Repair JSON to see a transparent list of every attempted fix.

Issues found
Fixes applied
Input bytes
Output bytes
JSON status

Frequently asked questions

JSON Repair is a browser-based tool that applies a narrow set of conservative syntax fixes to broken JSON — removing trailing commas, stripping comments, converting single-quoted strings to double quotes, and quoting bare property names. It shows a transparent report of every change and validates the result with JSON.parse before enabling export.

Paste your broken JSON into the input, choose which repair rules to apply using the checkboxes, and click Repair JSON. The tool shows the repaired output alongside a numbered change report. Copy or download the result only when the status shows Valid JSON.

The repair tool targets common mechanical issues: trailing commas before closing brackets or braces, JavaScript-style line and block comments, single-quoted strings and property names, and unquoted identifier-style property names. It does not guess missing data, invent values, or silently rewrite complex structural errors.

Yes, when Remove trailing commas is enabled. The tool scans the source using string-aware logic and removes each comma that is immediately followed by a closing object brace or array bracket. Each removal is listed in the repair report.

Yes, when Convert single quotes is enabled. The scanner tracks string state so apostrophes inside a properly double-quoted string are not mistakenly treated as string delimiters. Review the report to confirm each conversion.

Yes, when Remove comments is enabled. Line comments starting with // and block comments between /* and */ are stripped from outside quoted strings. Because comments may contain important documentation, keep the original source and review every removed comment.

Yes, when Quote bare keys is enabled. Identifier-style keys such as name: "value" are converted to "name": "value". Keys with unusual syntax or in ambiguous positions may still need manual editing after the automatic pass.

No. A successful syntax repair only means the candidate can be parsed as JSON. It does not prove that values are accurate, required fields are present, types match a schema, duplicate keys are safe, or business rules are satisfied. Always review the change report and keep the original source.

The tool never overwrites the input. The original source remains visible in the left panel while the repaired result appears separately on the right. You can compare both versions and discard the repair at any time.

The entire repair pipeline runs in your browser using JavaScript string operations and the native JSON.parse API. There are no fetch or XMLHttpRequest calls, and the tool does not persist your source in localStorage. Clipboard access and shared-device privacy remain separate considerations.

Use the repair report to identify which rules were applied and what remains unresolved. Open the result in JSON Validator for a precise error location. Common remaining issues include unterminated strings, missing brackets, malformed numbers, invalid escape sequences, or structural errors that require a manual fix.

JSON Validator diagnoses whether JSON is valid and reports the first syntax error with a line, column, and source excerpt. JSON Repair attempts a limited set of transparent mechanical fixes and validates the candidate after each pass. Use Validator when you want diagnosis without transformation, and Repair when you want automated help with known common patterns.

What is JSON Repair?

JSON Repair is a browser-based tool that applies a conservative, transparent set of fixes to broken JSON source. Rather than silently rewriting an entire document or guessing at missing data, it performs four specific, independently controllable operations and shows you exactly what changed before you export anything.

The four most common reasons JSON fails to parse in strict mode are trailing commas left by code generators, JavaScript-style comments added by developers for human readability, single-quoted strings used by programmers accustomed to Python or JavaScript object literals, and unquoted bare property names copied from code rather than data. These four patterns cover the overwhelming majority of "almost JSON" documents encountered in real workflows.

Remove comments — with string-aware scanning

JSON does not permit comments. Configuration files, toolchain outputs, and hand-edited API payloads frequently contain // line comments and /* block comments */ intended to explain values. A naive regex stripping // would corrupt URLs, URIs, and protocol-relative strings. ToolsSonic's comment stripper tracks double-quote string boundaries so only comments outside quoted strings are removed.

Convert single quotes to double quotes

JSON strings must use double quotes. Python dictionaries, JavaScript object literals, and informal JSON written by hand often use single quotes. The converter scans the source character by character, recognises string boundaries, and handles escaped quotes correctly — an apostrophe inside a double-quoted string is left unchanged, and an escaped single quote inside a single-quoted string is correctly translated to a plain character in the double-quoted result.

Quote unquoted bare keys

JavaScript object literals do not require property names to be quoted when they are valid identifiers. {name: "Ada"} is valid JavaScript but invalid JSON. The bare-key pass identifies identifier-style property names in object contexts and wraps them in double quotes. Keys that are already quoted, numeric, or in ambiguous positions are left for manual review.

Remove trailing commas — anchored lookahead

Code generators and editors sometimes leave a comma after the last item in an array or the last property in an object: [1, 2, 3,]. JSON.parse rejects this. ToolsSonic removes commas using an anchored lookahead that confirms the very next non-whitespace character is a closing bracket or brace — so property-separator commas elsewhere in the document are not touched.

Transparent repair report

Every change is numbered and described: the type of fix, which pattern was matched, and what was changed. The report appears immediately after repair so you can audit the transformation. Export — copy and download — is only enabled after the repaired candidate passes JSON.parse. If the result is still invalid, the interface tells you to review the remaining error and links to JSON Validator for diagnosis.

Privacy and safety

All repair logic runs in your browser with JavaScript string operations. No source text is uploaded, no remote repair API is called, and nothing is written to localStorage. The original input remains visible throughout so you can compare the before and after side by side.

Common use cases

  • Fixing an API response body with a trailing comma before use in a test
  • Removing // and /* */ comments from a JSON configuration file
  • Converting a Python dict or JavaScript object literal to strict JSON
  • Quoting bare identifier keys from a hand-edited or code-generated document
  • Reviewing every applied change before committing a repaired fixture
  • Separating syntax repair from schema validation and business-rule checks

Why use ToolsSonic's JSON Repair?

ToolsSonic's JSON Repair beats jsonrepair.net, onlinejsontools.com, and similar tools on transparency and safety.

Rule-by-rule control — Enable or disable each of the four repair rules independently. If you only want to remove comments, disable the other rules and only that change is applied. No other free online tool offers this granularity.

Numbered change report — Every fix is listed with its type and detail. You know exactly what was changed before you click Copy or Download. Competitors apply repairs silently with no record.

Export gate — Copy and Download remain disabled until the repaired candidate passes JSON.parse. You can never accidentally export still-broken JSON.

String-aware comment stripping — The comment stripper tracks quote state so URLs containing // and strings with slash characters are not corrupted. Most online regex-based strippers fail on these edge cases.

Anchored trailing-comma removal — The lookahead is anchored to the immediate closing token so commas between properties are never touched. This was a known bug in the reference implementation, corrected before integration.

Complete privacy — No fetch calls, no server round-trip, no localStorage writes.

100% private — runs in your browser Instant — no server round-trip Free forever — no account needed