Skip to main content
Free Free Tool

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.

Frequently asked questions

Why did my JSON come back with different formatting than I pasted? #
The document is parsed and re-serialised rather than cosmetically re-spaced, so a few things normalise: duplicate keys collapse to the last one, escaped forward slashes become plain slashes, \u escapes become real UTF-8 characters, and 1.0 may become 1. All of these produce equivalent JSON that parses the same way.
What is the most common reason valid-looking JSON fails to parse? #
A trailing comma after the final item, single quotes instead of double quotes, or unquoted keys. All three are valid JavaScript object literal syntax and none are valid JSON, which is why JSON copied out of a JS file so often fails.
Can I use this on very large IDs? #
Be careful. Integers larger than about 2^53 can lose precision when they pass through a numeric type, which affects things like Twitter/Discord snowflake IDs. The standard fix is to represent those IDs as JSON strings rather than numbers.
Does minifying change what my JSON means? #
No. Minify only removes whitespace between tokens, which JSON treats as insignificant. The parsed result is identical — it is simply smaller, which matters when the JSON has to fit in a header, an environment variable, or a URL.
Does the tool sort or reorder my keys? #
No. Object keys come back in the order you supplied them. If you need sorted keys for a stable diff, sort them before pasting or use jq with the -S flag.
Is my data stored? #
No. It is used to build the response and not written to disk or kept afterwards. Even so, redact live credentials or personal data before pasting anything into any online tool.