Definition:
JSON Bandwidth Inflation is the phenomenon where JSON, being a textual format, tends to be verbose, which results in increased network bandwidth usage and higher latencies. In simple terms β JSON wastes space by sending more bytes than the actual data needs, because of its human-readable, text-based nature.
JSON is designed to be readable by humans, not optimized for machines β and that readability comes at a bandwidth cost.
Simple Analogy π¦ Imagine shipping a small gift. Instead of a tight box, you use a giant cardboard box filled with bubble wrap just to label whatβs inside. The gift is small, but the package is huge. JSON is the oversized box.
Why Does It Happen? JSON is a textual format, which tends to be verbose. Every response must carry:
| Overhead Type | Example |
|---|---|
| Repeated key names | βusernameβ repeated in every object |
| No type compression | Numbers stored as plain text: βageβ: 25 |
| Whitespace & formatting | Spaces, newlines, indentation |
| Redundant structure | Brackets, quotes, colons everywhere |
Example:
Imagine an API returning a list of 3 users
Option 1 β Minified JSON (remove whitespace)
[{"id":1,"username":"alice","email":"alice@email.com","age":28,"is_active":true},{"id":2,"username":"bob","email":"bob@email.com","age":34,"is_active":false}]
Option 2 β Restructured (separate keys from values)
{
"fields": ["id", "username", "email", "age", "is_active"],
"rows": [
[1, "alice", "alice@email.com", 28, true],
[2, "bob", "bob@email.com", 34, false],
[3, "carol", "carol@email.com", 22, true]
]
}
β
Keys are declared once, not repeated per row β massive savings at scale!
Option 3 β Switch to Binary Format (Protobuf / MessagePack)
# Binary encoding β not human readable but 20β60% smaller
\x01\x05alice\x11alice@email.com\x1c\x01 ...