Skip to content
DevTinyTools

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.

0 chars
0 chars

Tip: press ⌘/Ctrl + Enter to format.

0 chars in · 0 bytes

How to format JSON

  1. Paste your JSON into the input panel on the left, or press “Load example” to start from a sample document.
  2. Choose an indent size using the selector above the editor. Changing it re-formats an existing result immediately.
  3. Press Format JSON or use ⌘/Ctrl + Enter. The output appears in the right-hand panel.
  4. 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.

Round-trip differences between pasted JSON and a JavaScript parser's output
You pasteYou get backWhy
{"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.

Common JSON parser errors, their likely cause and how to fix them
Parser messageLikely causeFix
Unexpected token } / Expected double-quoted property nameTrailing comma after the last memberDelete the comma that comes directly before } or ].
Unexpected token 'Single quotes used for a string or a keyReplace every ' with " around strings and property names.
Unexpected token n / Expected property nameUnquoted object key, e.g. {name: "x"}Wrap the key in double quotes: {"name": "x"}.
Unexpected token /A // or /* */ comment was left in the fileRemove comments, or switch to JSONC/JSON5 if your tooling supports it.
Unexpected end of JSON inputA closing brace, bracket or quote is missingCount 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.

Frequently asked questions

Is my JSON uploaded to a server?
No. Formatting, minifying and validating all run inside this page using the browser's built-in JSON parser. The text you paste is never sent over the network, stored in a database, or written to the URL.
Does formatting change my data?
Whitespace is the only thing formatting is meant to change, and keys, values and nesting are preserved. Four engine-level differences are worth knowing, all covered below: integers above 2^53 lose precision, keys that look like array indices are reordered ascending, duplicate keys collapse to the last value, and numbers are re-printed in their shortest form (1.0 becomes 1).
Why did my 64-bit ID come back with a different last digit?
JSON has one number type, and JavaScript implements it as an IEEE-754 double, which holds 53 bits of integer precision exactly. A snowflake or database id such as 9007199254740993 is stored as 9007199254740992. Send such ids as strings, or format with a tool that keeps the number text instead of parsing it.
Why does valid-looking JSON get rejected?
The most common causes are a trailing comma before a closing bracket, single quotes instead of double quotes, property names without quotes, and comments. Standard JSON allows none of these, even though JavaScript object literals do.
Which indentation should I use?
Two spaces is the most common default in JavaScript projects and matches the Prettier and ESLint defaults. Four spaces is easier to scan in deeply nested documents. Whichever you pick, keep it consistent across the repository so diffs stay readable.
How large can the input be?
The editor accepts up to 2,000,000 characters. Everything is processed in the tab, so the practical limit is your device's memory. For multi-hundred-megabyte files, use a command-line tool such as jq instead.
Can I use this tool offline?
Yes. Once the page has loaded, the JSON processing has no network dependency, so it keeps working if your connection drops. Reloading the page still requires a connection the first time.
Is there an API?
No. This is a browser tool only. There is no public endpoint, and deliberately so: adding one would mean your JSON leaves your machine.