JSON Repair Tool – Fix and Validate JSON
Paste broken JSON, validate it, auto-fix common syntax mistakes, and format, minify or convert the result, entirely in your browser.
Paste Your JSON
Your JSON is processed in your browser. Data is not uploaded to Logrith.
How to Fix JSON
- Paste or type your JSON into the input box above.
- Click "Validate" to check it, or click "Auto-Repair" directly if you know it has common mistakes.
- If repair succeeds, review which fixes were applied, then click "Accept repaired JSON" to replace the editor content.
- Use "Format" to beautify the result, "Minify" to compress it, or switch tabs to view it as a tree, TypeScript interface, or CSV.
What This JSON Repair Tool Does
- Validation: parses your JSON and reports the exact line and column of the first syntax error.
- Automatic repair: fixes trailing commas, unquoted object keys, and single-quoted string values when it safely can.
- Formatting: beautifies JSON with a selectable indent of 2 spaces, 4 spaces, or a tab.
- Minification: strips all unnecessary whitespace for compact output.
- Tree view: renders parsed JSON as a collapsible nested structure you can explore.
- Conversions: generates a TypeScript interface or, for array-of-objects data, a CSV file.
What Is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data format used almost everywhere in modern software: API responses, configuration files, application settings, data exports, and the output of countless tools and scripts. It represents data as nested objects (key-value pairs in curly braces) and arrays (ordered lists in square brackets), with values that are strings, numbers, booleans, null, or further nested objects and arrays. Its simplicity is exactly why it's so widely used — and also why a single missing comma or stray quote can make an entire file unreadable to a parser.
Why JSON Becomes Invalid
JSON has strict, unforgiving syntax rules. Unlike some configuration formats that tolerate minor inconsistencies, a JSON parser will reject the entire document over a single misplaced character. The most common causes of invalid JSON are:
- Missing commas between properties or array items.
- Missing quotes around string values or object keys.
- Extra trailing commas left after the last item in an object or array — valid in JavaScript object literals, but not in strict JSON.
- Unmatched brackets or braces from a copy-paste that cut off part of the structure.
- Incorrect values, such as using single quotes instead of double quotes, or writing
undefinedinstead ofnull.
How to Fix JSON
The most reliable way to fix JSON is to let a parser point you to the exact location of the problem rather than scanning the whole document by eye. This tool does that two ways: the Validate button reports a precise line and column for the first error the browser's own JSON parser encounters, and the Auto-Repair button attempts to fix the specific categories of mistakes that are common enough to handle safely and predictably.
JSON Validator
Click "Validate" to run your input through JSON.parse(). If it succeeds, you'll see a confirmation that the JSON is valid. If it fails, the browser's error message is parsed for a character position — when present, that position is converted into a line and column number by counting the newline characters in your input up to that point, so you can go straight to the offending character instead of re-reading the entire document.
JSON Formatter and Beautifier
Click "Format" to pretty-print valid JSON with consistent indentation. Choose 2 spaces, 4 spaces, or a tab from the indent selector before formatting. This is useful for making minified API responses or single-line config values readable, or for standardizing the style of a file before committing it to a repository.
JSON Minifier
Click "Minify" to strip all non-essential whitespace from valid JSON, producing the smallest possible representation. This is useful when you need to paste JSON into a size-constrained field, embed it in a URL parameter, or shrink a configuration payload before sending it over a network.
JSON Repair
The Auto-Repair button applies three specific, well-scoped fixes, in order, and re-validates after each pass:
- Trailing comma removal: a comma directly before a closing
}or]is removed. - Unquoted key quoting: an object key written without quotes (a valid JavaScript identifier followed by a colon) is wrapped in double quotes. Keys that are already quoted are left untouched.
- Single-quote conversion: string values wrapped in single quotes are converted to double-quoted strings.
After these fixes are applied, the tool re-parses the result. If it now succeeds, you'll see a list of exactly which of the three fixes changed something, and a button to accept the repaired JSON into the editor. If the JSON still doesn't parse, the tool tells you plainly that automatic repair could not fix it and shows the latest parse error so you can correct it by hand.
Honest limitations: this repair step cannot recover data that is genuinely missing (such as a value that was never written), cannot fix deeply malformed or truncated structures with multiple overlapping problems, cannot guess your intent when a key or value is ambiguous, and the single-quote conversion uses a scoped pattern that won't perfectly handle every case of escaped quotes inside a string. It is designed to reliably fix the handful of mistakes that account for most "nearly-valid" JSON, not to repair arbitrary broken text.
Developer Use Cases
This tool is built for the everyday moments developers run into broken JSON:
- Debugging API responses that fail to parse because of a server-side formatting bug.
- Cleaning up configuration files hand-edited by someone who used JavaScript object syntax instead of strict JSON.
- Working with AI-generated JSON output, which frequently includes trailing commas, unquoted keys, or single quotes when a model approximates JSON from training patterns rather than strict syntax.
- Quick data exchange between tools that expect slightly different JSON conventions.
- Web development, where a malformed JSON fixture or mock-data file can block local testing until it's fixed.
- Generating types and tabular exports directly from a JSON payload without writing a one-off script.
JSON to TypeScript
Once your JSON parses successfully, switch to the TypeScript tab to generate a basic interface. The tool infers each field's type — string, number, boolean, or null — and recurses into nested objects to generate additional named interfaces, and into arrays to infer an element type from the first item. An empty array is annotated as any[] with a comment noting that its type couldn't be inferred, since there's no element to examine.
JSON to CSV
The CSV tab works specifically for JSON shaped as an array of flat objects — the common shape for exported records or API list responses. The tool builds a header row from the union of every key that appears across all objects, in the order each key first appears, then writes one row per object with proper CSV escaping (quoting any value containing a comma, quote, or newline, and doubling internal quotes). If your JSON isn't in that shape, the tool explains clearly why CSV export isn't available instead of producing a broken file.
Frequently Searched Terms
People use this tool when searching for phrases like "fix json online," "json validator," "json syntax error checker," "json repair tool," "json to typescript converter," and "json to csv converter" — this page is built to answer exactly those needs in one browser-based tool.
JSON Repair Tool FAQ
Top JSON Repair Tool Search Queries
- json repair tool online
- fix json syntax error
- json validator free
- json formatter and beautifier
- json to typescript converter
- json to csv converter online
- fix trailing comma json
- json minifier online