Paste broken, malformed, or near-JSON text and get valid, parseable JSON back instantly. Fixes trailing commas, missing quotes, truncated output, and AI-generated JSON. Free, private, no signup required.
Open JSON Repair Tool →Malformed JSON appears in many situations: API responses from buggy services, configuration files edited by hand, database exports with encoding issues, and increasingly, structured output from large language models (LLMs) that do not strictly adhere to JSON syntax. The JSON repair tool handles all of the following error categories automatically:
Standard JSON (RFC 8259) forbids trailing commas - a comma after the last element in an array or the last key-value pair in an object. Many code generators and hand-written configs include them because JavaScript allows them. The repair tool removes trailing commas silently.
// Broken
{"users": ["Alice", "Bob", "Carol",]}
// Repaired
{"users": ["Alice", "Bob", "Carol"]}
Keys and string values must be wrapped in double quotes in JSON. Text from database shells, Python repr() output, or JavaScript object literals often uses single quotes. The repair tool converts single-quoted strings to double-quoted strings and adds missing quotes around unquoted keys.
// Broken (Python-style dict)
{'name': 'Alice', 'active': True, 'score': None}
// Repaired
{"name": "Alice", "active": true, "score": null}
Python uses True, False, and None where JSON expects true, false, and null. JavaScript uses undefined which has no JSON equivalent. The repair tool normalizes these to valid JSON values.
String values in JSON must not contain raw newlines, tabs, or other control characters. These must be escaped as \n, \t, etc. Strings copied from multi-line text fields, terminal output, or log files often contain raw control characters that fail JSON validation. The repair tool escapes them automatically.
Standard JSON has no comment syntax. Configuration files that started life as JSONC (JSON with Comments) or were annotated by a developer often contain // line comments or /* block comments */. The repair tool strips all comments and returns clean JSON.
JSON written to a file or sent over a network may be cut off mid-write due to a crash, timeout, or buffer overflow. Truncated JSON fails to parse because it has unclosed strings, arrays, or objects. The repair tool closes all open structures to produce the most complete and valid representation of the truncated data.
When asking an LLM like GPT-4 or Claude to produce JSON, the response is frequently wrapped in a markdown code fence: ```json ... ```. This wrapper makes the output invalid JSON. The repair tool detects and strips markdown code fences, returning only the JSON content.
The repair process uses a lenient parser that processes the input character by character and builds a corrected output as it goes. Unlike a strict JSON parser that throws an error at the first problem, the repair parser:
undefined values).The result is valid JSON that JSON.parse() will accept in any programming language without errors.
Building a product that asks an LLM to return structured JSON is increasingly common. However, LLMs do not always produce perfectly valid JSON - they add trailing commas, wrap the output in markdown, or occasionally output Python-style booleans. Running the repair tool on the raw LLM response before calling JSON.parse() makes your integration more robust and eliminates a whole class of runtime errors.
Applications that persist state to a JSON file (Electron apps, VS Code extensions, local-first web apps) can produce incomplete JSON if the process crashes mid-write. The repair tool can often recover most of the data from a truncated state file, which may be faster than asking the user to start over.
Some database export tools and ETL pipelines produce JSON-like output that is not quite valid - often due to encoding issues or column value escaping problems. Running the repair tool on the exported file is faster than modifying the export configuration or writing a custom post-processing script.
When a third-party API returns JSON that your parser refuses to accept, the repair tool helps you identify what exactly is wrong and gives you a corrected version to test against. This is faster than reading the raw response and spotting the error by eye.
Free, instant, 100% private. No account needed.
Open JSON Repair Tool →Also useful: JSON Validator | CSV to JSON Converter | JWT Decoder | JSON Guides