JSON Formatter & Validator — Beautify, Minify, Find Errors
Pretty-print, minify and validate JSON, with parse errors located by line and column. In your browser, no upload.
{
"name": "Pine & Birch",
"founded": 2019,
"services": [
"AI agents",
"web development",
"consulting"
],
"office": {
"city": "Newmarket",
"province": "ON"
},
"active": true
}Runs entirely in your browser. Nothing you enter is sent to us or stored. Building an API or integration that moves JSON like this between systems? That is what our development team does.
Found a problem, or something that could be better? We read every message and we fix things quickly.
This free JSON formatter validates and pretty-prints JSON in your browser. Paste an API response, a config file or a log line, and it is re-indented instantly; if it does not parse, the error tells you the line and column instead of a bare “Unexpected token”. Nothing is uploaded, so production payloads and API keys stay on your machine.
It uses the browser's own JSON parser, the same one Node.js, React and every modern runtime rely on, so “valid” here means valid everywhere. Minify for a request body or a config that must stay small, sort keys to make two documents diffable, and read the key count and nesting depth to get a feel for a payload before you write code against it.
How to use
- Paste your JSON into the input box. The result updates as you type.
- Choose Format for readable output, or Minify for a single compact line. Pick 2 spaces, 4 spaces or tabs to match your codebase.
- Turn on Sort keys when you need to compare two JSON documents; identical data then produces identical text.
- If the input is invalid, read the line and column in the red status line and fix that spot. The most common causes are a trailing comma, single quotes, or an unquoted key.
- Copy the result or download it as a .json file.
Frequently asked questions
Why does my JSON fail with “Unexpected token”?
Almost always one of four things: a trailing comma after the last item in an object or array, single quotes instead of double quotes, an unquoted key such as {name: 1}, or a comment. JSON allows none of those, even though JavaScript does. This tool reports the line and column, which usually points straight at the offending character.
Is my data uploaded anywhere?
No. Parsing and formatting happen in your browser with JSON.parse and JSON.stringify. You can disconnect from the internet after the page loads and it keeps working, which is the simplest proof. That makes it safe for payloads containing tokens or customer data, though the usual care about what you paste into any browser tab still applies.
What is the difference between formatting and minifying?
Formatting (beautifying) adds line breaks and indentation so people can read the structure. Minifying removes every unnecessary character so machines move it faster: a minified document is typically 20 to 40 percent smaller. The data is identical either way; only the whitespace changes.
Does it support JSON5, JSONC or comments?
No, and deliberately. Those are supersets used by some config files (VS Code settings, tsconfig) but rejected by APIs and by JSON.parse. If you paste JSONC here it will fail on the first comment, which is the correct answer to “will my API accept this”. Strip the comments first if you need a strict version.
Is there a size limit?
Only what your browser can hold in a text box comfortably. Documents of several megabytes format in well under a second on a laptop; beyond about 50 MB most browsers get sluggish, and a command-line tool such as jq is the better choice.
Why sort keys?
Two JSON documents with the same data but different key order are different text, so a diff tool shows every line as changed. Sorting keys recursively makes the order canonical, so diffs show only real changes. It is also how many systems produce stable hashes of JSON content.
JSON rules that trip people up
• Keys and strings must use double quotes. 'single' quotes are JavaScript, not JSON.
• No trailing commas. The last element of an object or array is followed directly by } or ].
• No comments of any kind, and no undefined or NaN values; use null.
• Numbers cannot have a leading zero or a trailing dot: 0.5 and 12 are fine, 05 and 12. are not.
• The top level can be any value, including a bare string or number, but most APIs expect an object or array.
When to minify and when not to
Minify anything sent over the network at volume: API request and response bodies, configuration embedded in HTML, data files fetched by a page. Gzip already removes most whitespace cost, so the gain is modest, but it is free. Do not minify anything a person has to edit or review: configuration checked into a repository, fixtures in a test suite, or documentation examples. Readability there is worth far more than a few hundred bytes.
Related free tools
- Base64 Encoder / Decoder — Encode text or files to Base64 and decode back, with correct UTF-8 handling and data-URL output. Nothing leaves your browser.
- Regex Tester — Test a regular expression against sample text with live match highlighting, capture groups and replace preview. Free, in your browser.
- JWT Decoder — Decode a JWT's header and payload, read the expiry in plain language, and verify an HMAC signature. Tokens never leave your browser.