JSON Formatter
Pretty print, compact or validate JSON, and see exactly where invalid JSON goes wrong.
Result
How it works
Your text is read with the rules of JSON itself, in your browser. It is never run as JavaScript, so comments, trailing commas, single quotes and unquoted names are reported as errors instead of being quietly accepted. An error tells you what was expected, what was found, and the line and column.
Formatting changes only the spaces and line breaks between values. Numbers, strings and the order of keys stay exactly as you typed them, so a long number such as 12345678901234567890 keeps every digit. If the same key appears twice in one object, both are kept and the page tells you, because most programs read only the last one.
The tool reads up to 1,000,000 characters and 500 levels of nesting.
What this result means
The result is your JSON with only the spaces and line breaks changed, or a message saying where it is invalid.
Examples
- A comma after the last item in a list: Reported as an error with its line and column, because JSON does not allow it
Assumptions and limitations
- It formats and checks JSON only. It does not sort keys, convert other formats or repair errors for you.
