JSON Fmt

JSON formatter and validator

Pretty-print, minify or validate JSON in the browser, with the line and column of the first error and an option to sort keys.

Paste JSON and press Format.

What the tool does

Format parses the text with the browser's JSON parser and writes it out again with the indent you chose, one key per line, nested objects and arrays indented under their parent. Minify writes it with no whitespace at all, which is what you want in a URL or a config that must be small. Validate checks the text without changing it. All three use JSON.parse, so what this page accepts is exactly what a JavaScript program accepts.

Reading the error

When the text is not valid JSON the result shows the parser's message and, where the browser reports a position, the line and column of the first problem. The usual causes, in order of how often they come up:

Sorting keys

Sorting orders every object's keys alphabetically, at every level. It changes nothing about the data (JSON objects are unordered by definition) but makes two documents easy to diff and makes a large config easier to scan. Arrays keep their order, because order in an array is data.

Numbers, dates and big integers

JSON.parse turns every number into a double-precision float, so integers above 2^53 (about 9 × 10^15) lose precision: an id like 12345678901234567890 comes back rounded. If you see the last digits change after formatting, that is why; treat such ids as strings in your own code. Dates are just strings in JSON; the formatter does not touch them.

Privacy

Nothing you paste leaves the page. There is no server-side formatter, no analytics on this page, and the copy button uses the browser's clipboard on your device.

Updated 2026-09-16. The text you paste stays in your browser; this page makes no network request with it.