JSON Formatter

Paste JSON to format, minify, search, or validate it instantly, and switch to a collapsible tree view to explore the structure. Everything runs in your browser, so your JSON is never uploaded, never sent to a server, and never sent to an AI.

Input JSON

Formatted output

Input: 75 BOutput: 101 BLines: 8Keys: 3Depth: 2Objects: 1Arrays: 1

Example JSON is ready.

Formatting runs in this browser. Your JSON is not sent to a server. Drop a .json file on the input panel to load it, or use Open .json file.

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

  1. Paste, drop, or open your JSON. Paste JSON into the input box, drag and drop a .json file onto the input panel, or open a file from your device.
  2. Choose the indentation. Pick 2 spaces or 4 spaces for the formatted output.
  3. 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.
  4. Explore or repair. Turn on Tree to browse the parsed output, or use Repair to preview safe, deterministic fixes before you apply them.
  5. Copy, download, or share. Copy the result, download it as a .json file, 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.

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.

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.

Frequently asked questions

Is it safe to paste JSON into an online formatter?

With ToolNava, yes. Formatting, searching, and validation run in your browser tab using the built-in JSON parser, and the JSON you paste is never uploaded and never sent to a server.

Does ToolNava upload or store my JSON?

No. Your input is read locally by the page and the result is produced on your device, so there is no upload step and no server-side copy. The only copy kept is an autosave in this browser's own storage so your work survives a refresh; it stays on your device, and Clear removes it. A share link keeps the JSON in the URL fragment, which is also never sent to a server.

Does ToolNava use AI to format JSON?

No. Formatting and repair use deterministic code, so the same input always produces the same output. Nothing is rewritten by an AI model, and your JSON is never sent to one.

What does the Tree view show?

Tree view replaces the output panel with a collapsible tree of the parsed result, so you can expand and collapse objects and arrays while keeping the text editor in the input panel. It reads the same parsed value the formatter produced, so it only appears when the output is valid JSON; otherwise you see the formatted text plus a short note. Expand all and Collapse all are available in the tree toolbar.

How does the search work?

The search box does a case-insensitive substring search over the input JSON and never changes your data. It shows a match count, highlights the matching line in the editor, and lets you step through results with Prev and Next. Clearing the search box removes the highlight. When nothing matches, it reports No matches.

Can it repair broken JSON?

Yes, but only safe, deterministic fixes such as adding missing quotes, removing trailing commas, and replacing True/False/None — never a guess at your intent. Repair shows a preview that lists every change and the repaired result, and nothing is applied until you press Apply repair. If it cannot repair the JSON, it says so and leaves the input untouched.

Are there line numbers and syntax highlighting?

Yes. The editors show a line-number gutter, and the editor colour-codes JSON keys, strings, numbers, booleans, and null so the structure is easy to scan at a glance.

Can I drag and drop a JSON file?

Yes. Drop a .json file anywhere on the input panel to load it; the panel shows a drag state while you hover a file over it. You can still use Open .json file to pick a file from your device. The file is read in the browser and never uploaded.

How do share links work?

Copy link encodes your current input into the URL fragment after #data= and copies the full address to your clipboard. Anyone opening that link sees the same JSON loaded into the formatter. The data lives in the link itself and is decoded in the browser, so it is never sent to a server. If the JSON is too large to fit in a link, the tool tells you instead of trimming it.

What keyboard shortcuts are available?

Cmd/Ctrl+Enter formats, Cmd/Ctrl+Shift+M minifies, and Cmd/Ctrl+K clears both panels. Shortcuts only fire with the modifier key held, so normal typing is unaffected.

What do the stats chips show?

Alongside input and output size and the output line count, the tool reports keys, depth, objects, and arrays for the current JSON, computed from the parsed document. These appear only when the current input parses, and they describe the whole document rather than just the visible part.

What does the Auto toggle do?

With Auto on, the tool re-formats your JSON about a quarter of a second after you stop typing, so the output stays in step with the input. With Auto off, the output only updates when you press Format JSON or Minify. Auto is off by default.

Does the tool remember my last input?

Yes. Your input is autosaved in this browser's local storage and restored the next time you open the page, so a refresh does not lose your work. Nothing is uploaded, and Clear erases the saved copy.

Can I format a JSON file from my computer?

Yes. Open or drag in a .json file, then use Format JSON or Minify and download the result. The file is read in the browser, so it stays on your device.

What happens if my JSON is invalid?

The tool reports the parser error in plain language, adds the line and column when the browser provides a position, and highlights that line in the editor so you can jump straight to it. It also clears the previous output so an old result is not mistaken for the current one. It never edits or reformats your input on its own — Repair only previews changes that you choose to apply.

Can I download the formatted result?

Yes. Use Download .json to save the output as formatted.json, or as your-file-formatted.json when you opened a file. You can also copy the result to the clipboard or share it as a link.

Is there a size limit?

There is no fixed limit set by the tool; the practical limit is the memory available to your browser. Very large input can be slow to parse and format, and a share link only works while the JSON is small enough to fit in a URL, so test with a smaller sample first.