JSON Formatter & Validator
Paste JSON to pretty-print it with 2 or 4 space indentation, minify it, or check whether it parses. Everything runs locally in this tab — nothing is uploaded.
Runs entirely in your browser — your JSON is never uploaded.
Tip: press ⌘/Ctrl + Enter to format.
0 chars in · 0 bytes
How to format JSON
- Paste your JSON into the input panel on the left, or press “Load example” to start from a sample document.
- Choose an indent size using the selector above the editor. Changing it re-formats an existing result immediately.
- Press Format JSON or use ⌘/Ctrl + Enter. The output appears in the right-hand panel.
- Copy or download the result. The download button saves a .json file with a timestamped name.
What each button does
- Format JSON parses the input and re-prints it with the selected indentation. Use it to turn a single-line API response into something you can read.
- Minify removes all optional whitespace. The output is semantically identical and noticeably smaller, which matters for request bodies and config files.
- Validate only parses the document. It leaves the output untouched, which is useful when you want a yes/no answer without rewriting what is in the editor.
- Swap moves the output into the input. Handy when you want to re-process a result with a different indent size or minify after formatting.
What changes besides whitespace
Formatting works by parsing your text into a JavaScript value and serializing it again. That round trip is what makes the output consistent, and it is also why the bytes that come back are occasionally not the bytes you pasted. Every difference below comes from the engine rather than from this tool — any formatter built on JSON.parse behaves the same way.
| You paste | You get back | Why |
|---|---|---|
| {"id":9007199254740993} | {"id": 9007199254740992} | Numbers become IEEE-754 doubles. Integers above 2^53 lose their last digits. |
| {"b":1,"2":2,"1":3} | {"1": 3, "2": 2, "b": 1} | Keys that look like array indices are enumerated first, ascending. That is a JavaScript object rule, not a JSON one. |
| {"a":1,"a":2} | {"a": 2} | Duplicate member names collapse silently: the last value wins and the others are gone. |
| {"x":1.0,"y":1e3,"z":-0} | {"x": 1, "y": 1000, "z": 0} | Numbers are re-printed in their shortest round-trippable form. |
| "\u00e9\/" | "é/" | Escapes are decoded, then only the ones that must be escaped are written back. |
Two of these bite in production. The first is precision: any id, nanosecond timestamp or hash sent as a bare number above 9,007,199,254,740,991 can come back changed. The fix is to send such values as strings in the source document — {"id":"9007199254740993"} — which is exactly why payment and social APIs return their ids as strings.
The second is key order. If anything downstream depends on member order — some signing schemes and diff-based caches do — an object whose keys are all numeric strings will be reordered on re-serialization. Either sort explicitly on both sides, or stop using purely numeric keys.
Common JSON syntax errors
The browser parser stops at the first problem it finds, so only one error is reported at a time. These are the messages you are most likely to see and what they usually mean.
| Parser message | Likely cause | Fix |
|---|---|---|
| Unexpected token } / Expected double-quoted property name | Trailing comma after the last member | Delete the comma that comes directly before } or ]. |
| Unexpected token ' | Single quotes used for a string or a key | Replace every ' with " around strings and property names. |
| Unexpected token n / Expected property name | Unquoted object key, e.g. {name: "x"} | Wrap the key in double quotes: {"name": "x"}. |
| Unexpected token / | A // or /* */ comment was left in the file | Remove comments, or switch to JSONC/JSON5 if your tooling supports it. |
| Unexpected end of JSON input | A closing brace, bracket or quote is missing | Count the opening and closing pairs, starting from the innermost block. |
Message text differs between browsers. The position is reported by the engine and should be treated as a pointer to the problem area rather than an exact diagnosis.
Why formatting is worth the keystroke
Minified JSON is optimised for machines, not people. A single missed comma in a four-kilobyte single-line payload can take minutes to find, because every character sits at the same indentation level. Re-printing the document gives the structure back: nesting becomes visible, array items line up, and one member per line means a version-control diff shows exactly which value changed.
Formatting is also the quickest sanity check available. If a payload formats cleanly, it is at least syntactically valid JSON — which rules out an entire class of bugs before you start looking at your application logic. For a deeper look at why a document is rejected, the JSON validator reports the parser message together with a structure summary.
Where your data goes
Nowhere. DevTinyTools does not send the contents of the editor to any server. There is no API call behind the buttons, no analytics event containing your text, and no localStorage or cookie copy of it. The trade-off is deliberate: it keeps the tool safe for payloads that contain tokens, customer records or internal configuration.