Developer Tools
JSON Repair
Auto-fix broken JSON in your browser. Repairs trailing commas, single quotes, unquoted keys, comments, smart quotes, NaN, Python True or False, and more.
JSON Repair tool
Try a sample
Repaired JSON
Line 1, column 1: Input is empty.
The tool tries every documented repair, but some inputs are too broken to recover safely (for example, unmatched braces deep inside nested structures). Use the line and column to locate the offending character.
Repair log
Each entry shows the line, column, and the kind of fix applied.
No repairs were applied because the input could not be parsed.
What this tool fixes
- Trailing commas in objects and arrays
- Single-quoted strings and smart curly quotes
- Unquoted object keys like { name: "Ada" }
- Line comments with // or # and block comments with /* */
- Python literals: True, False, None, and bare nan, inf
- JS literals: NaN, Infinity, undefined
- Hex (0x1F), octal (0o17), and binary (0b101) numbers
- Leading + on numbers and numbers starting with a dot
- Raw newlines, tabs, and carriage returns inside strings
- Markdown code fences and leading or trailing prose
- NDJSON (multiple values) wrapped into a single array
- Auto-closed unterminated objects and arrays at end of input
What this tool does not change
- Key order is preserved as parsed, then re-serialized with the chosen indent.
- String content is preserved character for character; only the surrounding quote style and any necessary escapes change.
- Numbers are normalized to JSON form but values are not rounded unless the source used a non-decimal base.
- Duplicate keys in an object are kept in source order; the last one wins after re-parsing (standard JSON.parse behavior).
- Strict JSON booleans and null pass through unchanged with no repair recorded.
JSON repair vs JSON5 vs JSON
JSON5 is a permissive superset of JSON that allows comments, trailing commas, single quotes, and unquoted identifier keys, but JSON5 is a separate format and most APIs and parsers do not accept it. Strict JSON (RFC 8259) is what almost every parser, validator, and HTTP API expects. This tool reads JSON5-style and other permissive variants and emits strict JSON so the result is safe to paste into any consumer.
Privacy and performance
The parser runs entirely in your browser. The input never leaves your device, and there are no analytics or network calls on this page. The implementation is a single-pass tokenizer plus recursive-descent parser, so even large payloads up to one million characters parse in a fraction of a second on modern devices.
How to use
- Paste broken JSON, a JavaScript object literal, an LLM response wrapped in a code fence, or NDJSON into the input. Up to one million characters at a time.
- Try a sample with one click to see the repairs in action: LLM-style JSON, JS object literal, Python-style dict, smart quotes with leading prose, NDJSON, or a truncated object.
- Read the repair log to see every change with line and column. Each row says what was fixed (for example, Removed trailing comma, Quoted unquoted object key, or Replaced NaN with null).
- Pick an indent for the output: 2 spaces (the most common default), 4 spaces, or Minified for a single-line transport-ready string.
- Click Copy repaired JSON to grab the strict JSON output, or read the error panel for the line and column when an input is too broken to recover safely.
About this tool
JSON Repair takes a string that looks like JSON but is not strictly valid and rewrites it as strict, RFC 8259 JSON that any parser will accept. The repair engine is a single-pass hand-written tokenizer and recursive-descent parser that understands every common deviation from strict JSON: trailing commas at the end of objects and arrays, single-quoted strings and curly smart quotes pasted from chat or word processors, unquoted identifier-style object keys ({ name: "Ada" }), JavaScript line comments with // and block comments with /* and */, # line comments, Python literals (True, False, None), JavaScript literals that are not strict JSON (NaN, Infinity, undefined), numbers in hex (0x1F), octal (0o17), and binary (0b101) form, numbers with a leading + or a leading dot (.5), backslash line continuations and raw newlines, tabs, and carriage returns inside string literals, UTF-8 byte order marks, markdown code fences with ```json blocks, leading and trailing prose ("Sure, here is your JSON: ..."), missing commas between sibling entries, semicolons used instead of commas, equals signs used instead of colons, and NDJSON-style input where multiple top-level JSON values appear back to back (these are merged into a single array). Truncated payloads with unmatched closing brackets are auto-closed where it can be done unambiguously. Every repair is recorded with its line and column so you can see exactly what was changed. The output is then re-parsed with JSON.parse and re-emitted with the indent of your choice (2 spaces, 4 spaces, or minified), so a successful repair guarantees the result is real, strict JSON. Useful for cleaning up JSON copied from LLM chats, log lines, code comments, or hand-written config; for taking a JavaScript object literal you found in a stack trace and turning it into something a JSON validator will accept; for converting NDJSON to a regular array; and for finishing the last 10% of a payload an API client truncated mid-write. Everything runs locally in your browser. The input you paste here, including any internal data or secrets, is not uploaded.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
JSON Formatter
Format, minify, and validate JSON in your browser.
Open tool
DeveloperJSON Minifier
Compact JSON with live byte savings and a JS literal copy.
Open tool
DeveloperJSON Diff Checker
Structural compare with paths for added, removed, and changed values.
Open tool
DeveloperJSON Escape / Unescape
Escape text into a JSON string literal or decode an escaped JSON string back to plain text.
Open tool
DeveloperJSON to TypeScript Converter
Generate TypeScript interfaces or types from any JSON value with full inference.
Open tool
ConverterYAML to JSON Converter
Two-way YAML and JSON converter with anchors, flow, and block scalars.
Open tool