JSON is a text format for structured data, and it is easy for machines to read but hard for people to scan once everything sits on one line. This formatter turns that single line into indented, readable output, or does the opposite and strips the whitespace back out with Minify. It also checks the syntax on every action: if the value is not valid JSON, you get the parser’s error message instead of a result. Both editors show line numbers and colour-coded syntax so you can scan structure quickly.
How to use the JSON formatter
- Paste, drop, or open your JSON. Paste JSON into the input box, drag and drop a
.jsonfile onto the input panel, or open a file from your device. - Choose the indentation. Pick 2 spaces or 4 spaces for the formatted output.
- Format, minify, search, or turn on Auto. Select Format JSON to beautify the value, Minify to remove whitespace, type in the search box to jump between matches, or turn on Auto to format as you type.
- Explore or repair. Turn on Tree to browse the parsed output, or use Repair to preview safe, deterministic fixes before you apply them.
- Copy, download, or share. Copy the result, download it as a
.jsonfile, or copy a share link that carries the JSON in the URL.
With Auto off, editing the input clears the output panel, so what you see in the result box always belongs to the JSON currently in the input box. With Auto on, the output is refreshed for you a moment after you stop typing. Either way there is a Clear action that empties both panels, resets the file name, and erases the autosaved copy.
Explore the structure with the tree view
When the output is valid JSON, the Tree button swaps the output panel for a collapsible tree of the parsed value. Objects and arrays can be expanded and collapsed node by node, and the tree toolbar offers Expand all and Collapse all for a one-click overview. The input panel always stays a text editor, so you can compare the raw text with its structure side by side. Because the tree is built from the same parsed value the formatter produced, it appears only for valid output; when the output is not valid JSON you see the formatted text plus a short note explaining why the tree is unavailable.
Find values with search
The search box performs a case-insensitive substring search over the input JSON and never modifies your data. It reports a match count, highlights the matching line in the editor, and lets you step through results with Prev and Next. Clearing the box removes the highlight, and when nothing matches it reports No matches.
Repair broken JSON safely
Repair applies a small set of deterministic fixes — adding missing quotes around keys, removing trailing commas, and replacing Python-style True, False, and None — and then shows a preview. The preview lists every change it made and displays the repaired JSON in a read-only editor, with an Apply repair button. Nothing is ever applied automatically: if you do not press Apply repair, your input is untouched. When a document cannot be repaired this way, the tool says so and leaves the input alone. No AI is involved, and the same broken input always yields the same preview.
Keyboard shortcuts
The shortcuts cover the actions you reach for most:
- Cmd/Ctrl+Enter — Format JSON
- Cmd/Ctrl+Shift+M — Minify
- Cmd/Ctrl+K — Clear
Each one only fires while the modifier key is held, so ordinary typing is never interrupted.
Share a link, and read the stats
Copy link encodes the current input into the URL fragment after #data= and copies the full address to your clipboard, so anyone opening it loads the same JSON. The data stays in the link and is decoded in the browser, and the tool tells you when the JSON is too large to fit in a URL rather than trimming it. Alongside the existing size and line chips, the tool reports keys, depth, objects, and arrays for the current JSON whenever it parses, computed from the parsed document.
Why your JSON stays private
The formatter has no backend step. When you press Format JSON or Minify, the page parses the text with the JSON parser built into your browser and writes the result back into the page. No request is made with your data, so there is nothing to upload and nothing to log on a server. Formatting also works while you are offline once the page has loaded.
There is no account to create and no cloud project to save your documents into, so the tool never becomes the place where a copy of your data lives. Opening a file from your computer reads it locally through the browser’s file reader; the file is not transmitted, and the download you get back is generated from the text already in the page. Repair is deterministic code, not a model, and a share link keeps your JSON in the URL fragment that only ever reaches the page itself. And no AI service is involved at any point: the output is produced by deterministic serialization, so the same input always yields the same result and your JSON is never sent to a model to be rewritten.
The one convenience that does touch storage is the autosave. Your latest input is kept in this browser’s own local storage so a refresh does not lose your work. It stays on your device, it is not synced anywhere, and the Clear action removes it.
What to do when JSON is invalid
If the input cannot be parsed, the tool reports the parser’s error in plain language and highlights the offending line in the editor rather than leaving a stale result on screen that could be mistaken for the current one. When your browser’s parser reports a position for the problem, the message also names the line and column, which is usually faster to act on than scanning a large document by eye.
The tool never silently fixes your data for you. Repair can suggest safe, deterministic fixes, but it always shows you the changes first and waits for you to press Apply repair, so whatever is wrong in the source stays visible and stays yours to change. That is deliberate: silent repair is how a formatter can quietly alter values you meant to keep.
The most common causes are small:
- Trailing comma —
{"a": 1,}is not valid JSON. Remove the comma after the last member. - Unquoted key —
{name: "ToolNava"}is not valid JSON. Keys must be double-quoted:{"name": "ToolNava"}. - Single quotes —
{'a': 1}is JavaScript object syntax, not JSON. Use double quotes for keys and strings. - Control characters or a stray comment —
//comments and unescaped newlines inside strings are not allowed in JSON.
Correct the input, or let Repair preview the safe fixes, then run Format JSON again. Because the output panel was cleared, the next successful result is unambiguously the one produced from the corrected text.