JSON Formatter
Pretty-print, minify, or validate JSON with detailed error reporting.
- Free · no sign-up
- Instant results
- Privacy-friendly
Other Developer Tools
What this JSON formatter actually does
Paste JSON, pick an action, and get it back readable. Pretty-print re-indents the document with four spaces so nested objects and arrays line up and you can see the structure at a glance. Minify strips every byte of insignificant whitespace, which is what you want before putting JSON in a config value, an environment variable, or a request body where size matters. Validate parses the document and tells you what it contains without changing it.
The important thing to understand is that this is not a cosmetic find-and-replace on whitespace. Your input is parsed into a real data structure and then re-serialised. That is what makes the output trustworthy — if it comes back formatted, it genuinely parsed — but it also means the output is normalised JSON rather than a byte-for-byte copy of what you pasted with different spacing.
What normalising changes, and why it matters
Because the document is parsed and re-encoded, a few things are deliberately cleaned up on the way through. Knowing about them saves you a confusing diff later.
- Duplicate keys collapse. JSON allows the same key twice in one object; a parser cannot. The last occurrence wins, so {"a":1,"a":2} comes back as {"a":2}. If you are debugging an API that emits duplicate keys, this tool will hide the duplication rather than show it.
- Forward slashes are not escaped. Many encoders emit "http:\/\/example.com"; the output here keeps the readable "http://example.com". Both are valid JSON and both parse identically.
- Non-ASCII characters stay as themselves. Accented letters, CJK text, and emoji come back as real UTF-8 characters instead of \u-escapes, which makes the output far easier to read and is still valid JSON.
- Number formatting is normalised. 1.0 may come back as 1, and integers beyond roughly 9 quadrillion (2^53) can lose precision, because they pass through a numeric type on the way. If you are handling large IDs such as snowflake IDs, keep them as strings in your JSON.
- Key order is preserved. Objects come back in the order you supplied them — the tool does not sort keys.
Reading the error message
When the document does not parse, you get the parser's own reason rather than a generic failure. "Syntax error" almost always means a stray trailing comma after the last item in an object or array, a single quote where JSON requires a double quote, or an unquoted key — all three are legal in JavaScript object literals and none of them are legal in JSON, which is the single most common way valid-looking JSON turns out to be invalid.
"Control character error" usually means a real newline or tab is sitting inside a string value where it needs to be written as \n or \t. "Malformed UTF-8 characters" points at an encoding mismatch upstream — the text was probably read as Latin-1 somewhere before it reached you.
Privacy
The document is parsed to produce the response and is not written to disk or retained afterwards. That said, treat any online formatter the way you would treat any third-party service: if the payload contains live credentials, personal data, or access tokens, redact them first, or use a local formatter such as your editor's built-in JSON support or jq.