JSON formatter and validator
What this JSON formatter does
An API response arrives as one long line and you need to see its shape, or it will not parse at all and you need to know where. This page does both without sending anything anywhere: the parsing, the indentation and the tree view all happen in your browser.
How to use it
- 1 Paste the JSON into the box, or press Load an example to see how it behaves.
- 2 Choose the indentation, and tick Sort keys if you are comparing two responses.
- 3 Press Format. If the JSON is broken you get the line and column; if not, switch to Tree to explore it.
The error message tells you what, not where
Browsers report a broken document differently: some give a character offset, some a line and column, some neither. This page reads whichever form your browser produced and turns it into a line and column, then prints that line with a caret under the exact spot. When no position can be recovered, the message is still shown but no line is marked, because pointing at the wrong line is worse than pointing at none.
Formatting and minifying are the same button, two ways
Both rebuild the document from the parsed value, so the output is always valid JSON even when the input had odd spacing. Minifying strips every space between tokens, which is what you want before putting a payload in a header, a query string or a test fixture.
{"id":7,"tags":["a","b"],"ok":true}
{ "id": 7, "tags": [ "a", "b" ], "ok": true }
Sorting keys makes two responses comparable
Object keys have no defined order in JSON, so two servers can return the same data in a different sequence and a plain text comparison lights up everywhere. Sorting the keys puts both into the same shape first. Arrays are deliberately left alone: in an array the order is part of the data, not noise.
Nothing you paste leaves this page
JSON that needs formatting is usually a live API response, and it often carries a token, a customer record or an order. There is no upload step here and no server side to this tool: the whole thing runs in the page you already have open.