JSON Repair
Paste almost-JSON from a log, a chat answer or a JavaScript snippet and get valid JSON back, with a clear report of every change.
Processed locally in your browser· Your data stays in your browser.
What is JSON Repair?
Real-world “JSON” is often not valid: JavaScript object literals with single quotes and unquoted keys, Python dictionaries with True/None, output copied with // comments, arrays cut off in the middle, or code wrapped in a Markdown fence. Strict parsers reject all of these.
This tool uses the jsonrepair library to rewrite such input into valid JSON. It never modifies data silently: the original stays in a separate panel, a warning banner tells you that a repair took place, and a report lists the first parse error and the kinds of fixes that were needed. If the text is already valid, it says so and leaves it untouched.
How does it work?
- Paste the broken JSON. Example: {a:1,'b':'x',}.
- Read the status banner and the report to see what was wrong and what was changed.
- Compare with the Original panel and check the values, especially when the input was truncated.
- Choose an indentation and copy or download repaired.json.
Common use cases
- Cleaning a JavaScript object literal copied from source code or a console.log.
- Rescuing an LLM answer that returned JSON with trailing commas or a code fence.
- Recovering a JSON file that was truncated by a crashed process or a size limit.
- Converting Python dict output (single quotes, True, None) into real JSON.
Examples
Try this input in the tool above:
{name: 'Ada', active: True, tags: ['math', 'code',], // a comment
score: 9.5,
{
"name": "Ada",
"active": true,
"tags": [
"math",
"code"
],
"score": 9.5
}Privacy
JSON Repair runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.
Limitations
Repair is a best guess. Missing data cannot be recovered, and ambiguous inputs may be interpreted differently from your intent, so always review the result before using it.
Frequently asked questions
What kinds of problems can be fixed?
Single or curly quotes, unquoted keys, trailing or missing commas, comments, Python constants (True, False, None), NaN/undefined, ellipsis placeholders, unclosed brackets or strings, and Markdown code fences around the JSON.
How can I be sure nothing was changed silently?
The banner turns orange whenever a repair happened, the Original panel keeps your input, and the report lists the first error position plus the categories of fixes. The repaired text is then re-parsed strictly and the result of that check is displayed.
What happens if my JSON is already valid?
The tool tells you it is already valid and only reformats it with the chosen indentation. Nothing else is altered.
Related tools
JSON Validator
Check whether a piece of text is valid JSON and locate the exact character where it goes wrong.
JSON & Data
JSON Formatter & Beautifier
Turn a minified or messy JSON document into readable, consistently indented text, with a precise error message if the JSON is invalid.
JSON & Data
JSON Minifier
Compress a JSON document to one compact line and see how many bytes you saved.
JSON & Data
JSON Viewer
Explore a JSON document as an expandable tree instead of a wall of text, with a summary of its structure.
JSON & Data
JSON Escape
Turn any text, even a whole JSON document, into a safe string you can embed inside another JSON value.
JSON & Data
YAML to JSON Converter
Turn YAML into strict JSON, resolving anchors, aliases and merge keys along the way.
JSON & Data