JSON Minifier
Paste JSON -> Minify -> Copy. Remove whitespace, reduce file size. Free, instant, private.
Data before and after minification
| Type | Formatted | Minified | Saved |
|---|---|---|---|
| package.json | 1.2 KB | 680 B | -43% |
| API Response | 4.8 KB | 2.9 KB | -40% |
| Config File | 820 B | 510 B | -38% |
| GeoJSON | 12.4 KB | 7.1 KB | -43% |
How to minify/prettify JSON in popular languages
Click to load an example into the input
What is JSON Minification?
JSON minification is the process of removing all unnecessary whitespace from JSON data — including spaces, tabs, newlines, and indentation — without altering the data structure or values. The result is a more compact JSON string that consumes less bandwidth during network transmission and less storage space.
An important fact: the JSON specification (RFC 8259) does not mandate indentation. Whitespace in JSON exists purely for human readability. Parsers only care about data structure, not formatting. Therefore, minification never affects data integrity.
Why Minify JSON?
Minifying JSON provides several practical benefits:
- Reduced payload size: Typically 20-50% reduction depending on the original indentation level. JSON indented with 4 spaces saves more than 2-space indented JSON.
- Faster page loads: Smaller API payloads mean shorter load times, especially critical on slow mobile networks.
- Bandwidth savings: With millions of requests per day, a 30% reduction in JSON size can significantly reduce CDN and bandwidth costs.
- Faster parsing: Parsers process shorter strings faster, reducing client-side JSON.parse() time.
- Efficient storage: JSON data in databases (MongoDB, Redis, PostgreSQL JSONB) occupies less space.
How JSON.stringify Works
This tool uses the built-in JSON.stringify() function. The process involves two steps:
- Step 1 — Parse:
JSON.parse(input)converts the JSON string into a JavaScript object. If the JSON is invalid, this step throws a SyntaxError. - Step 2 — Serialize:
JSON.stringify(obj)converts the object back to a JSON string, with no whitespace by default (minified). The optional third parameter (indent) controls formatting.
When to Minify (and When Not To)
| Minify | Keep Formatted |
|---|---|
| API responses sent to clients | Config files that humans read/edit |
| Data stored in databases | JSON in git repos (hard to diff when minified) |
| JSON embedded in HTML/JS bundles | API docs and schema documentation |
| Data sent over WebSocket | Files being debugged |
Common JSON Errors That Block Minification
- Trailing comma:
{"a": 1,}— JSON does not allow trailing commas. Remove the comma after the last element. - Single quotes:
{'key': 'value'}— JSON requires double quotes. Change to"key". - Comments: JSON does not support comments (
//or/* */). Strip them before minifying. - Unquoted keys:
{key: "value"}— All JSON keys must be enclosed in double quotes. - Large files: For JSON files over 50MB, use a streaming parser (like JSONStream in Node.js) instead of JSON.parse().
Minifying JSON in Production
In practice, JSON is often minified automatically by frameworks and build tools. Express.js does not add whitespace to res.json() by default. Nginx can compress JSON responses with gzip/brotli. Many CDNs automatically minify JSON responses.
However, manual minification is still useful for: config files embedded in environment variables, JSON payloads stored in databases, hard-coded data in source code, and when transmitting JSON over channels that do not support compression.
About Data Converters
Developer tools automate the repetitive parts of software work: formatting JSON, encoding/decoding Base64, decoding JWTs to verify token claims, generating UUIDs, formatting XML, diffing configurations. These aren't glamorous tasks, but they're the friction points that eat 10-15 minutes multiple times a day — adding up to hours weekly. Running them in a clean browser tab beats wrestling with CLI dependencies or IDE extensions that might ship your private data to a third party.
Why it matters
Fast, client-side developer tools fundamentally matter because they're used with sensitive data. JWT tokens contain user identity. Base64 payloads might encode API keys. JSON dumps include customer records. If a 'developer tool' sends your input to a server to process, you've just leaked production secrets. ZestLab's dev tools run 100% client-side with no network calls after page load — what you paste stays in your browser.
Privacy and safety
All developer tools here execute in-browser using pure JavaScript. There's no 'decode server' or 'format API' — your JWT, your JSON, your encoded payload is parsed by code running on your laptop. Verify this yourself with browser DevTools → Network tab: you'll see zero outbound requests when using any tool. That's a standard we hold because dev tools handle secrets.
Best practices
- Never paste production JWT or API tokens into ANY online tool without verifying it runs client-side (check the Network tab)
- Use browser private/incognito mode for one-off decoding of sensitive payloads
- Bookmark tools you use daily — ZestLab tool URLs are stable and don't require accounts
- When formatting JSON with secrets for team review, redact credentials before sharing the formatted output