JSON Formatter & Validator
Paste JSON to pretty-print it, check whether it is valid, minify it, or sort every key alphabetically. Errors are reported with the exact line and column.
Parsing uses your browser JSON engine, so what validates here is exactly what your code will accept. Nothing is sent to a server.
How to use
- 1Paste your JSON into the input box.
- 2Choose an indentation width, or minify to strip all whitespace.
- 3If the JSON is invalid, the exact line and column of the error is reported.
- 4Copy the formatted result, or download it as a .json file.
Frequently Asked Questions
Is my JSON sent to a server?
No. Parsing uses the JSON engine built into your browser, so the data never leaves your machine. That makes it safe for API responses containing production data.
Why does my JSON fail to validate?
The usual culprits are trailing commas, single quotes instead of double quotes, unquoted keys, and comments — all valid in JavaScript but not in JSON. The error message gives the line and column where parsing stopped.
What does sorting keys do?
It reorders every object key alphabetically at every level of nesting. This makes two versions of the same configuration diff cleanly, which is invaluable when comparing environments.
How much does minifying save?
Typically 15 to 30% for indented JSON, since whitespace is all that is removed. If you are sending JSON over the wire, gzip compression matters far more than minification.
Does formatting change my data?
No. Only whitespace changes; keys, values, ordering and types stay exactly as they were — unless you explicitly choose to sort keys.
Can it handle JSON Lines or trailing commas?
No. Both are common in practice but neither is valid JSON, so they are reported as errors. Remove trailing commas, and parse JSON Lines one line at a time.