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.

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?
Formatting only changes whitespace. The document is parsed and then re-serialized, so keys, values, ordering and nesting stay the same. Two exceptions are worth knowing: numbers are re-printed in JavaScript form (1.0 becomes 1, 1e3 becomes 1000), and integers larger than 2^53 can lose precision because JSON.parse stores them as doubles.
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.