JSON Tools
JSON Formatter
Format raw JSON with indentation that is easier to scan, review, and share.
Understand the format
How JSON Formatter works
Formatting rewrites only the whitespace between JSON tokens, so you can read a compressed payload without changing a single value.
What JSON formatting actually changes
JSON is defined by RFC 8259 as a token grammar in which whitespace between tokens is insignificant. Newlines, spaces, and tabs that sit between a comma and the next key can be added or removed freely without altering the document that a parser produces. That is the entire basis of pretty-printing: the formatter parses the text into values and then serialises those values again with indentation.
Because the round trip goes through a parser, formatting is also an implicit correctness check. If the input cannot be parsed, there is nothing to re-serialise, and the tool reports the parser error instead of guessing at a repair. A formatter never fixes broken JSON; it either reprints valid JSON or tells you why the text is not valid.
When compact output is the right answer
Indented JSON is for humans: code review, incident tickets, and documentation. Compact JSON is for transport and storage, where every byte of indentation is paid for on each request. The difference is smaller than it looks once HTTP compression is applied, because gzip and brotli collapse repeated runs of spaces very effectively, but it still matters for large payloads, message queues, and log lines that must stay on one line.
One practical rule: store and transmit compact, review and diff pretty. If a fixture file is committed to a repository, indented output produces far more readable version-control diffs, so the reviewability argument usually wins there.
Step by step
How to use JSON Formatter
- Paste the raw payload into the JSON input box on the left.
- Choose Pretty for two-space indentation, or Compact to strip all insignificant whitespace.
- If a red banner appears, read the reported position and fix that syntax error first; the formatter cannot reprint text it cannot parse.
- Copy the formatted result from the output panel into your ticket, fixture, or editor.
Formatting runs entirely in your browser using the built-in JSON parser. The payload is never transmitted, logged, or stored.
Troubleshooting
Common mistakes and how to fix them
- A trailing comma after the last element of an object or array.
- JSON, unlike JavaScript object literals, forbids trailing commas. Remove the comma before the closing brace or bracket.
- Very large integers such as 9007199254740993 come back changed.
- JavaScript numbers are IEEE-754 doubles, so integers above 2^53 - 1 cannot round-trip. Transport those identifiers as strings.
- Copying from a document editor introduces typographic quotes.
- Replace curly quotes with straight double quotes. The same applies to non-breaking spaces pasted from web pages.