{ } JSON Formatter & Beautifier
JSON pretty-print, beautifier, minifier, and validator — all in your browser
✓ Free Forever · ✓ No Signup · ✓ No Upload · ✓ Works Offline
🔒 Your data never leaves your device. All processing happens locally in your browser using JSON.parse + a lossless re-indenter. No upload, no server, no tracking.
Features
- Pretty Print — Re-indent JSON for easy reading. Only the whitespace changes — numbers, escapes and key order stay exactly as written.
- Minify — Compress JSON by removing all whitespace — ideal for APIs and config files.
- Validate — Check if your JSON is valid. An error names its line, column and the likely cause, and shows you the spot.
- Statistics — See key count, nesting depth, and data size at a glance.
How It Works
- Paste your JSON — Enter or paste JSON data in the input area.
- Format or minify — Click Format for pretty-print or Minify for compact output.
- Copy the result — Copy the formatted output to your clipboard.
Use Cases
- Pretty-print API responses for debugging
- Minify JSON config files for production
- Validate JSON before sending to APIs
Frequently Asked Questions
What indentation is used?
2 spaces by default. Pick 4 spaces or Tab next to the buttons — the choice is remembered in this browser, and only the whitespace changes.
Does it show where my JSON is broken?
Yes: the line and column of the first error, that line with a marker under the spot, and the usual cause in plain words — a trailing comma, single or curly quotes, an unquoted key, a comment, NaN, an invisible space. "Show in the input" selects it. It works the same in every browser: Safari's own JSON parser names no position at all and Chrome's leaves it out for some errors, so the formatter finds the spot itself.
Can it handle large JSON files?
Yes. The browser's native JSON parser is very efficient. Files up to several MB are handled smoothly.
Can it fix JSON that has comments, trailing commas or single quotes?
Yes. When the JSON is invalid, "Fix it for me" next to the error rewrites what JSONC, JavaScript or Python leave in: comments, trailing and missing commas, single or curly quotes, unquoted keys, True / None, NaN, a ``` code fence, several values in a row (JSON Lines → one list), a text cut off at the end. Every other value is copied exactly as written, the page lists each kind of change with its count, and your input stays as it was. Something it can't read with confidence — a bare word as a value, a ] closing a { — is left as an error instead of guessed.
Notes from Milo 🐨
I kept pasting a tsconfig with comments into this, getting "a comment — remove it", fixing one line, and pressing Format again for the next one. Now there's a "Fix it for me" button next to the error: comments, trailing and missing commas, single or curly quotes, unquoted keys, Python's True / None, a ```json fence from a chatbot, JSON Lines — rewritten in one go, with a list of every kind of change and your input left as it was. Everything else is copied digit for digit. Typing in a box holding a multi-MB file is quick again too: the key count now waits until you pause.
I pasted a 3,000-line API response with one stray comma into this on my phone, and all it said was "JSON Parse error: Unexpected comma at the end of array expression" — no line, nothing. Safari's own parser never says where, and Chrome skips it for a few mistakes too. So the formatter now finds the spot itself: line and column, the line with a marker under it, the usual cause in plain words (trailing comma, single or curly quotes, an unquoted key, a comment, an invisible space pasted from a chat), and "Show in the input" jumps there. Also new: pick 2 spaces, 4 spaces or a tab.
A formatter should only touch whitespace, and mine didn't: paste an ID like 12345678901234567890 and the "formatted" copy said 12345678901234567000. It also turned 1.10 into 1.1, decoded \u00e9 escapes, and when a key appeared twice it quietly threw one away. Now it re-indents your text exactly as written — every number, escape and key stays put — and tells you if a key is duplicated, since most parsers will keep only the last one. Files saved with a BOM open now, and the key/depth/size counters show real numbers instead of raw template text.
From the blog
- 📖 How to Format, Validate, and Beautify JSON — Pretty-print messy JSON, catch syntax errors with line numbers, and minify for production — all in your browser without uploading API responses full of tokens.
Related Tools
- ⚙️ YAML ↔ JSON — Convert YAML to JSON or JSON to YAML with validation
- 📊 CSV ↔ JSON — Convert CSV to JSON or JSON to CSV with custom delimiters
- #️⃣ Hash Generator — Generate cryptographic hashes from text or files
💬 Bug, idea, or just to say hi? Tell Milo 🐨 · [email protected]