JSON Formatter
Format, minify, and validate JSON. Choose an indent level to pretty-print for readability, or compress to a single line. Syntax errors are highlighted instantly.
Tips
- JSON keys must always be wrapped in double quotes. Single quotes are not valid.
- Trailing commas (
{"a":1,}) are invalid per the JSON specification. - Numbers in e-notation are valid. However,
NaNandInfinityare not. - Double quotes inside strings must be escaped as
\". Use\nfor newlines and\tfor tabs. - Minification is useful for reducing file size. Use the minified version for API transfers and the formatted version for config files.
Frequently Asked Questions
undefined, functions, NaN, and Infinity cannot be used.number type. Large integers may lose precision in JavaScript if they exceed MAX_SAFE_INTEGER.
Side Note — Why JSON Won Over XML
In the early 2000s, XML was the dominant data format. In 2001, Douglas Crockford proposed JSON as a lighter, more approachable, and more readable alternative. By the 2010s, JSON had become the standard.
For the same data, JSON is often 30–50% smaller in byte count than XML — a difference that directly translated to faster app response times in the era of mobile data connections.
RFC 8259 states that duplicate keys are "SHOULD NOT" — not prohibited. {"a":1,"a":2} is syntactically valid, but its behavior is undefined.