JSON formatter / minifier / validator
Paste any JSON to beautify, minify and validate it. Choose the indent, sort keys, escape or unescape strings — all processed locally in your browser.
Input
Waiting for inputResult
JSON essentials
JSON (JavaScript Object Notation) is a text format for structured data with exactly six value types: object, array, string, number, boolean and null. Its strictness is the point — because the grammar has no ambiguities, every language can parse it with a small, fast parser.
The rules that most often trip people up: keys and string values must use double quotes; there must be no trailing comma after the last property or element; comments are not allowed; and numbers cannot be NaN, Infinity or have a leading zero. If validation fails here, the error message points at the character position where parsing stopped, which is almost always just after the real mistake.
Formatting re-serialises the same data with indentation, which is a readability change only — it does not alter the parsed value. Minifying strips insignificant whitespace; that is what you want for request bodies, config files and anything sent over the wire. On large payloads the difference is often 30–50%.
Escaping turns JSON into a single-line string you can embed inside a source file or another JSON document; unescaping reverses it. This matters when you are pasting a payload into a test fixture, an environment variable or a CI config.
Numbers deserve a note: JSON has one numeric type, so a 64-bit integer from a backend can lose precision when parsed into a JavaScript number. If you are handling IDs or monetary amounts above 253, keep them as strings.
Because parsing here happens in your browser, it is safe to paste API responses, tokens and production data — nothing is transmitted anywhere.
Working with JSON in real projects
Beyond the basic grammar, five mistakes cause almost every failed parse in practice. Smart quotes pasted from a document or chat app — they must become straight " characters. A trailing comma after the last property, which JavaScript object literals tolerate but JSON does not. Comments, which are legal in some config dialects but never in JSON proper. A byte-order mark at the start of a file exported by a Windows tool. And a truncated paste — long payloads copied from a terminal often lose their tail. The validator reports the character position where parsing stopped, which is almost always just after the real mistake, so read one line back.
Duplicate keys are the quietest failure mode: JSON parsers accept them and keep the last value, so data silently disappears. Sorting keys alphabetically (the option above) makes duplicates and diffs far easier to spot — the other reason to sort is comparing two API responses by eye: with stable key order, a real difference stops hiding behind a formatting one.
JSON has no dates, no binary and only one number type, so conventions fill the gaps. Dates are stored as ISO 8601 strings (2025-01-01T12:00:00Z); the trailing Z is what prevents the classic off-by-timezone bug. Binary payloads are stored as Base64 strings (see the encoder page). And large integers need care: JSON numbers land in IEEE-754 doubles, so IDs above 253 — snowflake IDs, microsecond epochs — lose their last digits and should travel as strings instead.
JSON also has a family of dialects. JSON Lines / NDJSON puts one object per line so logs can be streamed and appended; JSONC and JSON5 relax the rules (comments, trailing commas, bare keys) for human-edited configuration — which is why a VS Code settings file can be “invalid JSON” and still be correct. And JSON Schema validates the shape of a document — required keys, types, ranges — where a validator here can only confirm it parses.
For size, minify then compress: removing whitespace typically saves 30–50%, but gzip or brotli save far more on top, because JSON repeats the same key names constantly. That is why wire payloads are usually minified + compressed, while pretty-printing is strictly a human-reading format.
Two workflow notes. Parsing happens in your browser, so pasting a production payload, a token dump or customer data is safe — nothing is transmitted. But the “copy share link” feature encodes the input into a URL: handy for your own tickets, wrong for anything secret. Need tabular data instead? The format converter turns CSV, YAML or XML into the same tree.
A debugging routine worth stealing: when an API returns something your code chokes on, pipe the raw body into the formatter first and look at it as data before you look at it as a problem. Half of all “the JSON is invalid” tickets are really “this is HTML” — a login page, a 502 error document or a rate-limit notice served with the wrong content type, which the formatter will show you in one second. The other half are responses that parse fine but contain a string field that is itself JSON — APIs do double-encode, especially in webhook payloads and configuration blobs. The Escape and Unescape buttons convert between the two representations without you hand-editing backslashes, and validation of the inner document is just the same button pressed again.
Frequently asked questions
What does “format” actually do?
It re-serialises your JSON with consistent indentation so it becomes readable, without changing the data. Minify does the opposite: it removes all insignificant whitespace to make the payload smaller.
Why does my JSON fail validation?
The usual causes are single-quoted keys, a trailing comma after the last property, comments, or an unescaped control character inside a string. JSON requires double quotes around keys and string values.
Is my data uploaded?
No. Parsing, formatting and validation all happen in your browser. Nothing you paste leaves your device.
How to format JSON
- Paste JSON: Paste the JSON you want to work with into the input.
- Format or minify: Choose an indent and format, or minify and validate.
- Fix errors and copy: Use the error hints to locate issues, then copy the result.