About the JSON Fixer
JSON that will not parse is usually one of a small set of mistakes: single-quoted strings, keys without quotes, a trailing comma before a closing bracket, a comment, or a value that is legal in another language but not in JSON such as None, True, undefined or NaN. The fixer applies a sequence of targeted rewrites for each of those, then parses the result with a strict parser and pretty-prints it.
It also handles two paste-related problems: a run of objects separated by newlines (as produced by log files) is wrapped in an array, and a missing comma between two values on adjacent lines is inserted. A leading byte-order mark is removed. Strings are only rewritten from single to double quotes when the whole string can be identified, so apostrophes inside double-quoted text are left alone.
The fixer is heuristic, so it can be wrong on unusual input. It never invents data, and if the rewritten text still does not parse it reports the remaining error with a line and column so you can finish by hand. Run the output through the JSON Validator if you need a second opinion.
How to use
- Paste the broken JSON, JavaScript object or Python dict into the left pane.
- The repaired, formatted JSON appears on the right. Read the amber message if part of it could not be repaired.
- Copy or download the result. For a compact version, send it to the JSON Minifier.
Common questions
- Which errors can the JSON Fixer repair?
- Single quotes, unquoted keys, trailing commas, line and block comments, Python and JavaScript literals (None, True, False, undefined, NaN, Infinity), missing commas between lines, concatenated objects, and a leading byte-order mark.
- Which errors can it not repair?
- Anything ambiguous: a missing closing bracket where it cannot tell which one, a string that was cut off, or binary garbage. In those cases it tells you where it gave up.
- Is JSON5 supported?
- Most JSON5 features (comments, trailing commas, single quotes, unquoted keys) are covered. Hexadecimal numbers and multi-line strings are not.
- Will it change my data?
- It changes syntax, not values. A number stays the same number, a string stays the same characters. Literals like None become null because JSON has no other way to express them.