Skip to content
XUtilHub

JSON Fixer – Repair Broken JSON Online

Fix invalid JSON automatically: missing quotes, trailing commas, single quotes, comments, unclosed brackets and more.

  • Free, no sign-up
  • Runs in your browser, nothing uploaded
Broken JSON
Output

About the JSON Fixer

Repair broken JSON automatically. The fixer adds missing quotes and commas, removes trailing commas and comments, converts single quotes, closes brackets, and more.

Key features

  • Adds missing quotes around keys and strings
  • Converts single quotes and smart quotes
  • Removes trailing commas and comments
  • Closes unbalanced brackets in truncated JSON
  • Converts Python True/False/None
  • Pretty-prints the repaired, valid JSON

Repair broken JSON automatically

Invalid JSON comes from everywhere: JavaScript object literals pasted into a config, Python dictionaries printed with print(), hand-edited files, log lines cut off at a character limit, and LLM responses with comments or trailing commas. The JSON Fixer repairs the most common problems in one step and returns clean, valid, formatted JSON.

Before and after

{name: 'Ada', 'age': 36, tags: ['math', 'computing',], // comment
 active: True, address: {city: "London"
{
  "name": "Ada",
  "age": 36,
  "tags": ["math", "computing"],
  "active": true,
  "address": {
    "city": "London"
  }
}

What gets fixed

ProblemExampleFixed to
Unquoted keys{name: 1}{"name": 1}
Single quotes{'a': 'b'}{"a": "b"}
Smart quotes{“a”: 1}{"a": 1}
Trailing commas[1, 2,][1, 2]
Missing commas{"a": 1 "b": 2}{"a": 1, "b": 2}
Comments// note, /* x */removed
Python constantsTrue, Nonetrue, null
Truncated data{"a": [1, 2{"a": [1, 2]}
Code fences```json … ```removed

When to use the fixer vs. fixing by hand

Use the fixer for syntax problems: quotes, commas, brackets and comments. If the problem is semantic, such as a wrong value or a missing field, the fixer can't know what you meant. Check the result with the JSON Validator and compare it with the original if needed.

Preventing broken JSON

  • Generate JSON with a serializer (JSON.stringify, json.dumps), never by concatenating strings.
  • Enable JSON validation in your editor.
  • In LLM prompts, ask for "valid JSON only, no comments" and use structured output modes where available.

Check validity with the JSON Validator; format with the JSON Formatter; fix TOML with the TOML Validator.

How to use the JSON Fixer

  1. Paste your data into the input box, upload a file, or click Sample to try it out.
  2. Adjust the options above the editor if you need to (indentation, delimiter, and so on).
  3. The result appears instantly in the output panel. Any errors are shown with their line and column.
  4. Click Copy to copy the result, or Download to save it as a file.

Frequently asked questions

What can the JSON Fixer repair?

Missing or single quotes, unquoted keys, trailing commas, comments, missing commas between items, truncated documents with unclosed brackets, Python constants, escaped strings, MongoDB-style values like ObjectId("..."), and concatenated strings.

Is the repaired JSON always what I intended?

Usually, but the fixer has to guess, especially with truncated data. Always review the output, particularly the end of documents that were cut off.

Can it fix JSON from ChatGPT or other AI tools?

Yes. LLM output often includes trailing commas, comments, Markdown code fences or truncated responses. The fixer handles these well.

What library powers it?

The open-source jsonrepair library, running entirely in your browser.

Is my JSON uploaded to a server?

No. All JSON tools run entirely in your browser, so your data never leaves your device.

Is there a size limit?

There is no fixed limit. Files of several megabytes work fine; very large files depend on your device's memory.

Do I need an account?

No. Every JSON tool is free and works without signing up.

Last updated:

Related JSON tools