JSON Formatter & Beautifier
Paste minified or messy JSON and get it pretty printed, minified or sorted. It runs in your browser, and only the whitespace changes.
Ctrl+Enter also works. Your JSON is processed in your browser and never sent to a server.
A Formatter That Does Not Touch Your Data
The quick way to pretty print JSON is JSON.stringify(JSON.parse(text), null, 2), and most online formatters do exactly that. It reads the text into JavaScript values and writes those values back out, which is not the same thing as re-indenting your text. Here is what that round trip changes:
| You wrote | After parse and stringify | Why it matters |
|---|---|---|
| 12345678901234567890 | 12345678901234567000 | Past 2^53, a JavaScript number cannot hold every integer, so an order or account id is rounded. |
| 49.90 | 49.9 | The trailing zero of a price disappears. |
| 1E2 | 100 | Exponent notation is rewritten. |
| "\u00e9" | "é" | Escapes are decoded, so the bytes change. |
| {"a": 1, "a": 2} | {"a": 2} | A repeated key is silently dropped. |
This formatter reads the structure itself and prints every number, string and key back character for character, so the left column is what you get. Validity is still decided by your browser's own JSON parser, which implements the standard, so a document is never called invalid unless it really is.
What You Can Do With It
Pretty print an API response
Paste a one-line response from curl or the network tab and read it as a tree of indented objects. Choose 2 spaces, 4 spaces or tabs.
Minify a payload
Strip every optional space before you paste JSON into an environment variable, a test fixture or a request body. The size before and after is shown.
Prepare a text diff
Sort keys on both files before a line diff or a code review, so key order no longer shows up as a change.
Find the broken comma
Invalid JSON is not formatted. You get the line and column of the first error, a click that selects it, and the guide that explains the fix.
Formatting or Validating?
Both tools check that your JSON is valid. This page is for shaping it: indentation, minifying and key order. If you only need to know whether a document parses and where it breaks, the JSON Validator is the shorter path, and to explore a large document and copy the path to a value, use the JSON Viewer. To see what changed between two versions, the JSON Compare tool lists every added, removed and changed value. When either one finds an error, the JSON error guides show the wrong and right version side by side, from trailing commas to unexpected token.