Last updated
Example: Nested Object
// Before (formatted, 312 bytes):
{
"user": {
"id": 42,
"profile": {
"firstName": "Alice",
"lastName": "Smith",
"address": {
"city": "New York",
"country": "US"
}
},
"roles": ["admin", "editor"],
"active": true
}
}
// After (minified, 121 bytes — 61% reduction):
{"user":{"id":42,"profile":{"firstName":"Alice","lastName":"Smith","address":{"city":"New York","country":"US"}},"roles":["admin","editor"],"active":true}}
Example: Large API Response
// Typical REST API response (formatted):
{
"status": "success",
"data": {
"users": [
{
"id": 1,
"name": "Alice",
"email": "alice@example.com"
},
{
"id": 2,
"name": "Bob",
"email": "bob@example.com"
}
],
"pagination": {
"page": 1,
"perPage": 20,
"total": 150
}
}
}
// Minified:
{"status":"success","data":{"users":[{"id":1,"name":"Alice","email":"alice@example.com"},{"id":2,"name":"Bob","email":"bob@example.com"}],"pagination":{"page":1,"perPage":20,"total":150}}}
String Values Preserved Exactly
// Input (whitespace inside strings must be preserved):
{
"message": "Hello, World!",
"multiline": "Line 1\nLine 2\nLine 3",
"path": "C:\\Users\\Alice\\Documents",
"empty": ""
}
// Minified (string content unchanged):
{"message":"Hello, World!","multiline":"Line 1\nLine 2\nLine 3","path":"C:\\Users\\Alice\\Documents","empty":""}
// Note: spaces inside "Hello, World!" are preserved
// Only structural whitespace (between tokens) is removed
JSON5 to Standard JSON
// Input (JSON5 format with comments and trailing commas):
{
// Database configuration
host: 'localhost',
port: 5432,
name: 'myapp',
// Connection pool settings
pool: {
min: 2,
max: 10, // trailing comma
},
}
// Output (standard JSON, minified):
{"host":"localhost","port":5432,"name":"myapp","pool":{"min":2,"max":10}}
Size Statistics
File: api-response.json
Original (formatted): 4,820 bytes (4.7 KB)
Minified: 2,890 bytes (2.8 KB)
Reduction: 1,930 bytes (40%)
Estimated gzip (original): 890 bytes
Estimated gzip (minified): 780 bytes
Combined savings with gzip: 4,040 bytes (84% total reduction)
Note: Minified JSON compresses slightly better than formatted JSON
because repetitive whitespace reduces compression efficiency.
Validation Before Minification
// Invalid JSON — minifier catches the error:
{
"name": "Alice",
"age": 30,
"tags": ["admin", "editor",] ← trailing comma (invalid JSON)
}
// Validator output:
✗ JSON Syntax Error at line 4, column 31:
Unexpected token ']' — trailing commas are not allowed in JSON.
Tip: Use JSON5 mode if your input uses JSON5 syntax.
// Fixed:
{
"name": "Alice",
"age": 30,
"tags": ["admin", "editor"]
}
// Minified:
{"name":"Alice","age":30,"tags":["admin","editor"]}
Batch Minification
Processing 4 JSON files...
File Original Minified Savings
config.json 2,840 B 1,420 B 50%
api-response.json 4,820 B 2,890 B 40%
schema.json 12,400 B 7,440 B 40%
translations.json 38,200 B 22,920 B 40%
Total 58,260 B 34,670 B 40%
When to Minify JSON
- API responses: minify before sending to reduce bandwidth
- Configuration files: minify for production deployments
- Static JSON data files: minify before bundling with web apps
- Test fixtures: minify to reduce repository size
- Environment variables: minify JSON config for .env files
- Development: keep formatted for readability — minify only for production
Paste your JSON to minify it instantly. The minifier validates the JSON first and reports any syntax errors before attempting minification.
Example: Basic Minification
// Before (formatted, 187 bytes):
{
"name": "Alice",
"age": 30,
"email": "alice@example.com",
"active": true,
"score": null
}
// After (minified, 72 bytes — 62% reduction):
{"name":"Alice","age":30,"email":"alice@example.com","active":true,"score":null}