Logo JSON Parser Online

Repair Broken JSON Online

Paste malformed JSON and click Detect & Repair. The tool attempts to fix common issues — single-quoted strings, trailing commas, unquoted keys — and outputs clean, valid JSON. Useful when working with hand-edited configs, API responses that broke spec, or JavaScript object literals that aren't quite valid JSON.

All JSON Tools

28 tools

Free, fast, runs in your browser. No login needed.

Made with ❤️ in India · © 2025 parsejsononline.com
INPUT
1
OUTPUT
1
✅ Ready
Characters: 0
Ctrl+Enter to run
What is this tool?

How to use

  1. Paste your broken JSON into the INPUT pane.
  2. Click Detect & Repair.
  3. If repair succeeds, the output pane shows valid JSON formatted with 2-space indentation.
  4. If repair fails ("Could not repair automatically"), try fixing the most obvious issues manually — truncated JSON or deeply malformed structure cannot be recovered automatically.

How it works

The repair engine works by evaluating your input as a JavaScript expression using new Function('return ' + input). This is why it can handle constructs that are valid JavaScript but not valid JSON:

  • Single-quoted strings — {'key': 'value'} is valid JavaScript and gets repaired to standard double-quoted JSON.
  • Unquoted keys — {key: "value"} is legal in JavaScript object literals.
  • Trailing commas — {"a": 1,} is accepted in modern JavaScript engines.
  • Loose JavaScript object literals — if it can be returned from a function, it can be repaired.

What it cannot repair: Comments (// ... or /* ... */), truncated or incomplete JSON where a closing bracket is missing, very deeply malformed structure, or values that are not valid JavaScript (like bare identifiers that aren't object literals). For those cases, a manual edit is required.

On success, the repaired value is re-serialized through JSON.stringify(result, null, 2), producing properly formatted, valid JSON. The round-trip means undefined values are dropped and NaN/Infinity become null.

Common use case: config files hand-edited by non-developers who used single quotes; JavaScript object literals copied from source code; API responses from non-spec-compliant servers that include trailing commas.

FAQ

What kinds of errors can this fix?

Single-quoted strings, unquoted keys, trailing commas after the last item, and any other construct that is valid JavaScript but not valid JSON. The tool evaluates the input as a JavaScript expression and re-serializes it.

Why does repair fail on some inputs?

The repair relies on JavaScript evaluation. If the input is not valid JavaScript either — for example, it is truncated (missing closing brackets), contains comments, or includes bare identifiers — the evaluation throws and repair fails. You will see "Could not repair automatically." in that case.

Is eval safe here?

The repair runs entirely in your browser's JavaScript sandbox. It cannot access your files, network, or other browser tabs. However, evaluating arbitrary input as code means you should only use this tool with input you trust — not with untrusted third-party payloads.

Does repair change the data?

The values are preserved, but the output is re-serialized. Undefined values are dropped, NaN and Infinity become null (standard JSON.stringify behavior). Key order from the original input is maintained.

What if I just need to validate JSON, not repair it?

Use the JSON Validator. It reports exactly where in the input the syntax error is without modifying your data.

Is my data sent anywhere?

No. Repair runs entirely in your browser.

Related tools

JSON ValidatorPinpoint the exact location of syntax errors. JSON FormatterFormat valid JSON with indentation control. JSON EscapeFix escape sequence issues in JSON strings.