Repaired JSON will appear here...
Repairs the common JSON gotchas
π§Ή Trailing comma removal
JSON doesn't allow trailing commas after the last item in an object or array. JSONLab strips them automatically β a common issue when copy-pasting from JavaScript source.
π€ Quote conversion
Single-quoted strings are converted to double-quoted, with proper escaping of any embedded quotes. 'hello' becomes "hello" and "it's" stays valid.
π Key quoting
Unquoted object keys (name: ...) become quoted ("name": ...). Useful when fixing JavaScript-style object literals that need to be valid JSON.
π¬ Comment stripping
Both // line comments and /* block */ comments are removed. This makes JSONC files (JSON with comments, used by VS Code and others) parseable by strict parsers.
βΎοΈ NaN/Infinity handling
JavaScript's NaN and Infinity are not valid in JSON. The repair converts them to null, which is the standard JSON-compatible fallback for missing or unrepresentable numeric values.
π§½ BOM removal
Leading UTF-8 BOM characters are stripped. Some editors add a BOM by default, and many strict JSON parsers reject documents that start with one β this fix makes the file universally parseable.
Repairing JSON β common questions
What kinds of JSON errors can be repaired?
JSONLab's repair pipeline handles the most common JSON gotchas: trailing commas after the last item, single-quoted strings, unquoted object keys, // line comments, /* block */ comments, NaN and Infinity values (converted to null), and leading UTF-8 BOM characters.
Each fix is reported in the warnings panel below the workspace, so you can see exactly which transformations were applied. The repaired output is then parsed one more time to confirm it's valid JSON.
If your input has more serious structural issues β like mismatched braces or missing colons β you'll see the original parse error in the error panel and can fix it manually.
Will repair change my data?
Repair only changes syntax, not semantics. Strings keep their content (with proper escaping), numbers keep their value, objects keep their keys and structure, and arrays keep their order. The repaired output represents the same data as the input.
The one semantic change is that NaN and Infinity are converted to null, because they have no valid JSON representation. If your data relies on those values, you'll need to redesign your schema to use a different sentinel (e.g., a string like "NaN" or null explicitly).
Comments are stripped completely, so any documentation embedded in the JSON is lost. Keep a copy of the original if the comments matter.
What if the JSON is too broken to fix?
If the parser still fails after all repair passes, the tool shows the parse error message in the error panel so you can investigate further. Common unfixable cases include mismatched braces, missing colons between keys and values, and strings that are never closed.
The error message includes the line and column where parsing failed, which usually points you to the exact location of the remaining issue. Fix that one spot in the input and click Repair again.
For serious structural problems, you may also find the JSON Validator helpful β it shows the same error context with a visual pointer under the offending character.
Is the repaired JSON guaranteed to be valid?
Yes, with one caveat. If the repair succeeds (the status badge shows "Valid JSON" and output appears), the repaired text has been successfully parsed by JSON.parse and re-serialized β it's guaranteed to be valid JSON.
If the repair fails, no output is shown and the original parse error is displayed in the error panel. The tool never shows partially-repaired output that might silently pass through a downstream parser.
The warnings panel lists every transformation that was applied, so you can audit the changes before using the output in production.
Can I use this for JSON5 or JSONC?
JSONLab's repair handles a useful subset of JSON5 and JSONC features: comments, unquoted keys, single-quoted strings, and trailing commas. This covers the most common cases found in real-world config files like tsconfig.json (which allows comments), VS Code settings, and various JavaScript-style configs.
It is not a full JSON5 parser. Features like hexadecimal numbers, leading + signs, multi-line strings, or Infinity/NaN as first-class values are either converted to their JSON-compatible equivalents or left untouched. For a complete JSON5 experience, use a dedicated JSON5 parser.
For most config-file repair use cases, though, this tool is more than enough β and it's 100% browser-based, so your configs never leave your device.
You might also like
JSON Validator
Check JSON syntax with detailed error reports
JSON Formatter
Beautify and pretty-print JSON
JSON Beautifier
Pretty-print with syntax highlighting
JSON Escape
Escape and unescape JSON strings
JSON Minifier
Compress JSON to minimum size
JSON Tree View
Interactive collapsible tree visualization