JSON Formatter & Viewer — beautify & validate online
Format, validate, beautify or minify JSON, with syntax errors pointed at the exact position. Free online JSON viewer that never sends your data anywhere.
About the JSON formatter tool
JSON travels the internet as a single unbroken line. That is exactly what you want in transit — every removed space is bandwidth saved on millions of requests — and exactly what you do not want when an API response is not doing what the documentation promised and you need to find out why. Indenting it turns an impenetrable wall of braces into a structure you can actually read.
The other half of the job is validation, and it is usually the more urgent one. JSON is unforgiving: a single trailing comma, an unquoted key, a smart quote pasted in from a word processor, or one missing closing brace makes the entire document invalid, and the parser that rejects it often says nothing more helpful than "unexpected token". Pointing at the exact position of the error is what turns a twenty-minute hunt into a five-second fix.
Minifying is the same operation in reverse, and it has real uses beyond saving bytes. Configuration values that have to fit on one line, JSON embedded in an environment variable, a payload pasted into a curl command, or a value stored in a database column all want the compact form. Nothing about the data changes — whitespace between tokens carries no meaning in JSON, so the minified and indented versions are precisely equivalent.
The reason to do this in your own browser rather than on a server is the nature of the data. The JSON people need to inspect is API responses containing customer records, tokens, internal identifiers and configuration that includes credentials. Pasting that into a website that transmits it somewhere is a genuine, routine security mistake. Here the parsing happens in your tab, so the document never leaves the machine you are debugging on.
How it works
Paste your JSON
Drop in an API response, a config file or a log payload. It stays in the tab and is never transmitted.
Format or minify
Indent it into readable structure, or collapse it back to a single line for embedding somewhere it has to fit.
Fix any errors
Invalid JSON is reported with the position of the problem, so you can go straight to the character at fault.
Frequently asked questions
- Why is my JSON invalid when it looks fine?
- The usual culprits are a trailing comma after the last item in an object or array, keys written without double quotes, single quotes instead of double, or curly typographic quotes introduced by pasting through a word processor or chat client. JSON also forbids comments, so a config file with // notes in it is not valid JSON however sensible it looks.
- What is the difference between JSON and JavaScript objects?
- JSON is a strict subset. JavaScript allows unquoted keys, single quotes, trailing commas, comments, functions and undefined; JSON allows none of those. Code that works when pasted into a browser console can therefore still be invalid JSON, which surprises people regularly. Keys must be double-quoted strings and values must be strings, numbers, booleans, null, objects or arrays.
- Does formatting change my data?
- No. Whitespace between tokens has no meaning in JSON, so indenting and minifying are purely cosmetic — the parsed result is identical either way. Key order is preserved as written. The only thing that can change is how numbers are represented if they exceed what floating point can hold precisely, which is a property of JSON itself rather than of formatting.
- Can I paste JSON containing tokens or customer data?
- Yes, and that is a large part of why this tool works the way it does. Parsing and formatting happen in JavaScript inside your browser tab, so nothing is sent over the network, written to storage or logged. You can disconnect from the internet and it still works. Verifying that before pasting a production payload into any online formatter is a habit worth having.
- Why does minifying barely shrink my file?
- Because minifying only removes whitespace between tokens, and if the JSON was already compact there is nothing to remove. Size in JSON is dominated by keys and values, not formatting — repeated long key names across thousands of records are what make a payload large. Gzip on the wire handles that far better than minification can.
- How large a document can it handle?
- Files of several megabytes format quickly. Beyond that the limit is your browser rendering the formatted text rather than the parsing itself, so a very large document may make the tab briefly unresponsive. For inspecting a huge export, extracting the section you care about first is faster and easier to read.
- Does it validate against a schema?
- No — it checks that the document is syntactically valid JSON, not that it matches an expected shape. Confirming that a payload has the right fields with the right types is JSON Schema validation, a separate concern that needs the schema itself. Syntax errors are what block you most often, and those are what this catches.
