What the JSON formatter does
JSON from an API, a log file or a config export usually arrives as one long line. This tool parses it, checks that it is valid, and prints it back with consistent indentation so you can read the structure. It can also do the reverse and minify JSON by stripping whitespace, which is useful before you embed a payload in code or send it over the network.
Everything runs in your browser. The text you paste is not sent to a server, so it is safe to use with tokens, internal payloads and customer data you would not paste into a random website.
How to use it
Paste your JSON into the input box and choose Format to pretty-print it, or Minify to compress it. If the input is invalid, the tool reports the problem instead of silently changing your data, so you can fix it and try again. Copy the result with one click.
Example
A minified response becomes easy to read once formatted:
{"user":{"id":42,"name":"Asha","roles":["admin","editor"]},"active":true}
→
{
"user": {
"id": 42,
"name": "Asha",
"roles": ["admin", "editor"]
},
"active": true
}Common JSON errors and how to fix them
Most "invalid JSON" messages come from a small set of mistakes. JSON is stricter than JavaScript object syntax:
- Trailing commas: {"a": 1,} is invalid. Remove the last comma.
- Single quotes: keys and strings must use double quotes, not 'single' quotes.
- Unquoted keys: {name: "x"} is JavaScript, not JSON. Write {"name": "x"}.
- Comments: JSON does not allow // or /* */ comments. Delete them before parsing.
- Special values: NaN, Infinity and undefined are not valid JSON values. Use null or a string.
- Unescaped characters: a raw line break or tab inside a string must be written as \n or \t.
Related tools
- JWT Token Decoder: Decode JSON Web Tokens (JWT) locally in your browser. Inspect headers, payload, and signatures.
- Base64 Encoder & Decoder: Encode and decode Base64 strings for APIs, data transfer, and debugging.
- Diff Checker: Compare two blocks of text and instantly see line-by-line additions, deletions, and unchanged content.
- Code Minifier: Minify JavaScript, CSS, HTML, or JSON by stripping comments and unnecessary whitespace.
