Loading...

About the JSON Formatter

JSON that arrives on one line is unreadable, and JSON that fails to parse tells you very little about where it went wrong. This formatter indents the document, validates it, and points at the offending position when parsing fails, which is usually enough to spot the trailing comma or unquoted key immediately.

Formatting happens entirely in your browser. That matters because the JSON people most often need to inspect is an API response, a webhook payload, or a decoded token — documents that routinely contain credentials, personal data, or internal identifiers that should not be pasted into a third-party server.

Note that formatting normalises whitespace only. It does not reorder keys or change values, so a formatted document is byte-for-byte equivalent to the original as far as any JSON parser is concerned.

Frequently asked questions

Why is my JSON invalid when it looks fine?

Overwhelmingly one of four things: a trailing comma after the last element, keys or strings quoted with single quotes instead of double, an unescaped control character or literal newline inside a string, or a comment. JSON permits none of these. JavaScript object literals permit all of them, which is why hand-edited config files break so often.

Are duplicate keys allowed in JSON?

The specification does not forbid them but calls the result undefined, and parsers disagree. Most take the last occurrence, some take the first, and a few error. Anything relying on that behaviour is a latent bug, and it has been used as a real attack when two components in a request path resolve the same duplicated key differently.

Does JSON preserve key order?

An object is defined as an unordered set of pairs, so nothing guarantees order and no consumer should depend on it. In practice most parsers preserve document order, and most serialisers emit insertion order, which is exactly enough consistency to let a dependency on it survive until the day it does not.

Why did my large integer lose precision?

Because JSON numbers have no defined precision and most parsers map them onto IEEE-754 doubles, which represent integers exactly only up to 2 to the power of 53. Identifiers such as Twitter or Discord snowflakes exceed that and are silently rounded. The standard fix is to transmit large identifiers as strings.

What is JSON Lines and when should I use it?

JSON Lines is one complete JSON document per line, with no enclosing array. It is the right format for logs and for streams, because a consumer can process each record as it arrives and a truncated file loses only the final record rather than becoming unparseable. A single enormous JSON array has to be read completely before anything can be done with it.

Need this managed for you, not just automated?

We're also a hands-on DevOps consultancy — Kubernetes, CI/CD, and cloud infrastructure.

Explore Our Services