JSON Formatter
Format, minify, validate, and explore JSON with a collapsible tree view, colorized syntax, and detailed stats — all local to your browser.
Loading tool…
What is JSON?
JSON stands for JavaScript Object Notation. It is a text format for structured data, invented by Douglas Crockford in the early 2000s and now the default way software exchanges information over the web. Its entire grammar fits on one page: objects in curly braces holding key–value pairs, arrays in square brackets, and four primitive types — string, number, boolean, and null. That deliberate smallness is why every language from Python to Java to Go can read it, and why almost every API you touch speaks it.
Because JSON ignores whitespace, the same document can be one unbroken 40 KB line or a neatly indented tree. Servers send the compact version to save bandwidth; humans need the indented version to read anything at all. Formatting — also called pretty-printing or beautifying — parses the text into a real data structure and re-serialises it with consistent indentation and line breaks, which also proves the document is syntactically valid along the way.
Why we built this tool
Every developer hits this daily: an API response pasted from a terminal, a config file from a container, a log line with an embedded payload — all technically readable, none of it actually readable.
The awkward part is that those payloads regularly contain access tokens, customer records, internal endpoints, and API keys. Pasting them into a random online formatter means pasting production secrets into someone else's server logs. We built ours to run entirely in your browser: the parsing and re-serialising happen in JavaScript on your machine, in your tab. Nothing is sent anywhere, so there is no upload to audit and no retention policy to trust. It also works offline once the page has loaded, which is handy when you are debugging on a locked-down network.
Tips and common mistakes
- If formatting fails, the error position is almost always a trailing comma, a single quote where a double quote belongs, or an unescaped quote inside a string.
- Two-space indentation is the convention in most JavaScript and web projects; four is common in Python-adjacent codebases.
- Very large payloads are easier to read collapsed — expand only the branch you are investigating.
- Strip credentials out of a payload before pasting it into a bug report, even though nothing left your browser here.
Open JSON Formatter with a link
JSON Formatter can be handed its input by the link that opens it, so the page arrives with the work already done. This is meant for assistants and scripts: if a chatbot, an editor extension, or a command-line agent already holds your content, it can build a link instead of asking you to copy and paste into a box.
The payload rides in the fragment — the part of a URL after the #. Browsers never send the fragment to a server, so anything handed over this way stays on your device exactly as a dropped file would. A link that uses the query string instead is rewritten into the fragment by the page before any analytics or ad script can read the address.
Prefix any field with gz — #gzjson= — to pass it as gzip-compressed base64url, which fits roughly five to ten times more into the same link. Links stay reliable up to about 8,000 characters; past that, chat apps and address bars start truncating them, and the page says so rather than loading half a document.
One exception to the privacy rule: ?url= tells the page to download the input from an address. That request goes from your browser straight to that server — not through ours — but it does leave your device, and it only works if the server allows cross-origin requests.
With My Gadgets installed as an app, a .json file opened from your desktop lands straight in this tool. The file is read locally, exactly like a drop.
#json=— the JSON document
Example: https://mygadgets.ink/tools/json-formatter/#json=...
Quick start: using JSON Formatter
- Paste your JSON into the input area above, or load it from a file.
- Choose your indentation — two spaces is the common default, four if your team prefers it.
- Format the document; if it is invalid, the error will point you at the offending position.
- Read or collapse the tree to find the part you care about.
- Copy the formatted output or download it as a .json file.
Related: JSON Validator for strict checking, JSON Diff to compare two payloads, and JSON to YAML to convert for config files.