JSON Formatter
Indent and beautify a JSON document with two spaces, four or tabs, keys sorted if you wish, entirely in your browser.
Runs entirely in your browser. Nothing is uploaded, logged or stored.
Paste a minified or badly indented JSON document and read it properly. Formatting happens in your browser, so a payload full of tokens and customer data never leaves your machine.
How it works
The document is parsed with the browser's own JSON parser, then written back out with the indentation you picked. Because it is a real parse rather than a text transformation, anything that comes out is guaranteed to be valid JSON, and anything invalid is reported with the position where the parser gave up.
Object keys keep their original order unless you ask for them to be sorted. Array order is never touched, because the order of elements in a JSON array is meaningful.
Examples
| Case | Input | Result |
|---|---|---|
| A minified object | {"id":7,"tags":["a","b"],"ok":true} | { "id": 7, "tags": [ "a", "b" ], "ok": true } |
Frequently asked questions
Is my JSON sent to a server?
No. The page loads a small script that parses and reformats the document locally. You can disconnect from the network after the page has loaded and the tool keeps working.
Why does my document fail with a trailing comma?
Trailing commas are valid in JavaScript but not in JSON. The same applies to comments, single quoted strings and unquoted keys: they belong to JavaScript object literals, not to the JSON specification.
Are my number values altered?
Numbers are re-emitted from their parsed value, so the notation can change even though the value does not: 1e2 comes back as 100. Integers beyond 2^53 are the one real limit, as they cannot be represented exactly.
Good to know
- Everything happens in your browser. The document is not uploaded, not logged and not stored.
- Integers larger than 2^53 lose precision, because JavaScript, which does the work here, reads every JSON number as a double precision float. Very large identifiers should be transported as strings.