JSON Formatter
Format, minify, sort and validate JSON, with errors pinned to a line and column.
Runs in your browserOptions
Input
Output
About this tool
Paste JSON and get it neatly indented, minified for transport, or sorted by key for a clean diff. The validator reports the exact line and column when something is wrong and shows the offending line with a caret under it, which turns an unhelpful character offset into something you can act on.
How to use it
- 1Paste your JSON into the editor.
- 2Choose whether to beautify with 2 or 4 spaces, or minify it for sending.
- 3Read the key count and nesting depth, then copy or download the result.
Frequently asked questions
How do I find my syntax error?
The parser reports a character offset, which is useless on its own for a long document, so this tool converts it into a line and column, prints that line, and puts a caret under the exact position. That is almost always enough to spot the missing comma straight away.
What does sorting the keys do?
It rewrites every object so its keys appear in alphabetical order, recursively at every level. Arrays keep their original order, because an array's order is meaningful data rather than presentation. Sorted output makes two versions of a file easy to compare.
Can it handle very large files?
Up to about five megabytes of text. Beyond that parsing blocks the browser's main thread for long enough to look like a freeze, so the tool refuses the input and says so rather than hanging. For files that large a command-line formatter is the better tool.