JSON Formatter

Format, minify, and validate JSON — copy and paste the result.

This free online JSON formatter pretty-prints or minifies JSON, with adjustable indentation and recursive key sorting. Invalid JSON shows a clear error with line and column when your browser can pinpoint it. No signup required, runs entirely in your browser.

Examples:

Mode

Indent

Sort keys

Sort object keys alphabetically, recursively through the whole document.

JSON Input
Valid JSON

Frequently asked questions

Paste your JSON into the input above with the mode set to Format. The tool validates it and pretty-prints it with your chosen indentation (2 spaces, 4 spaces, or a tab). Invalid JSON shows a clear error instead of a broken result.
Switch the mode to Minify. The tool removes all unnecessary whitespace and outputs the JSON on a single line — useful for reducing payload size before sending it over the network or storing it.
When enabled, every object's keys are sorted alphabetically, recursively through the whole document — including objects nested inside arrays. This makes it easy to diff two JSON documents that have the same data in a different key order.
The tool uses your browser's built-in JSON parser, so the error message is whatever your browser reports — common causes are a trailing comma, missing quotes around a key, single quotes instead of double quotes, or an unclosed bracket. When the browser can pinpoint it, the error includes the line and column.
No. Everything is parsed and formatted locally in your browser using the native JSON parser. Nothing is uploaded or stored on a server.