JSON formatter

Paste JSON in, get readable JSON out.

Machine-generated JSON usually arrives as one enormous line. This re-indents it so you can actually see the structure, and tells you exactly where the problem is if it will not parse at all.

Choose two spaces, four spaces or tabs. There is also an option to sort every object’s keys alphabetically, which is what you want when you are trying to compare two responses that should be the same.

Most online JSON formatters send your text to a server to do this. There is no reason to: it is a hundred lines of code that runs perfectly well in a browser, including on the API responses and log payloads you should not be pasting into someone else’s website.

Rewrites every object with its keys in order. Useful for comparing two files.

Questions

What happens if my JSON is invalid?
You get the line and column where the parser gave up, so you can go straight to the problem.
Is my data sent to a server?
No. The formatting happens in this page. That matters — JSON pasted into a formatter is very often an API response containing keys or personal data.