Skip to tool
ecech.
💻 Developer & Code

One Field Is Usually Most of Your Payload

Total size says there is a problem. Per-key size says which one, and the answer is rarely distributed evenly.

items instead

Total

Gzipped

 

Biggest field

 

Spent on key names

By field

What removing a field would save

Advertisement

How the calculation works

Where a typical payload actually goes thumbnailBase64 — 70% description the rest Optimising “the rest” is where most effort goes, and it is 14% of the problem. Removing one field and fetching thumbnails separately cuts the response by two thirds. Base64 also costs 33% more than the bytes it encodes, so it is expensive twice over.

How to Use This Tool

Paste a response and every field is measured. The share column is the one to read — it tells you where the effort belongs.

Measuring the right thing

Each field is measured as the bytes it contributes to the serialised document: the key name, the quotes, the colon, the value and the separating comma. That is what actually travels.

Fields inside arrays are aggregated across every occurrence, which matters enormously. A field costing 40 bytes per item is 40 KB across a thousand-item response, and looking at one item hides that completely.

The usual culprits

  • Base64 blobs. An embedded thumbnail or file is almost always the largest single thing, and base64 adds exactly 33% to whatever it encodes. Serving a URL instead removes the field and the overhead together, and lets the browser cache the image separately.
  • Long free text returned in a list view that only displays the first line.
  • Fields nobody reads. Internal identifiers, audit timestamps, denormalised copies. The cheapest optimisation available is deleting them, and the reason it does not happen is that nobody is sure who consumes them.
  • Deep nesting, where the structural characters start to rival the data.
“customerShippingAddressLine1” — 30 bytes, per item 10 items 300 bytes 1,000 items 30 KB 10,000 items 300 KB — bar cut off Gzip removes most of the wire cost. It does not remove the parse cost.
Shortening key names is rarely the right first move, and it is not nothing either.

Key names, and why gzip is not the whole answer

Key names repeat once per item. A field called customerShippingAddressLine1 spends 30 bytes on its name alone, which is 300 KB across a 10,000-item response before any value is included.

Gzip handles this well — repeated strings are exactly what it compresses — so the wire cost is far smaller than the raw figure suggests. The measurement here includes real gzip output rather than an estimate, so you can see the difference for your own data.

What gzip does not remove:

  • Parse time. The document is decompressed before it is parsed, so the parser still processes every byte.
  • Memory. The in-memory representation is larger than the JSON, not smaller.
  • Cost on constrained clients, where decompression itself is measurable.

So compare the raw and gzipped figures before acting. If gzip already removes most of a field's cost, renaming it buys little; if a field is large because its values are large and varied, gzip cannot help and removing it is the only option.

What to do with the answer

In rough order of payoff:

  1. Remove fields the client does not use. Free, and usually blocked by uncertainty rather than difficulty.
  2. Move blobs out of the payload and reference them by URL.
  3. Paginate, or let the client request the fields it wants.
  4. Truncate long text in list views and fetch it in full on demand.
  5. Shorten key names — last, because it costs readability and gzip has usually handled it already.
Advertisement

Frequently Asked Questions

How do I find what is making my API response large?
Measure each field's contribution rather than the total. One field is usually most of it — typically an embedded base64 blob or a long text field returned in a list view that only shows the first line.
Does gzip make payload size irrelevant?
No. It removes most of the wire cost of repetition, including long key names, but the parser still processes every byte after decompression and the in-memory representation is larger than the JSON. Compare the raw and gzipped figures before deciding what to act on.
Is it worth shortening JSON key names?
Rarely first. A 30-byte key name costs 300 KB across a 10,000-item response, which sounds significant until gzip compresses the repetition away. Removing unused fields and moving blobs out of the payload both pay far better and cost no readability.
Why are base64 fields so expensive?
Twice over. Base64 adds exactly 33% to whatever it encodes, and the encoded blob then sits inside a response that cannot be cached separately. Serving a URL removes the overhead and lets the browser cache the image on its own.
How much does nesting cost in JSON?
The structural characters — braces, brackets, quotes, colons and commas — become a measurable share once documents are deeply nested or contain many small objects. It is visible in the analysis here as the gap between the field totals and the document size.
What should I remove first?
Fields the client never reads. It is free and usually blocked by nobody being certain who consumes them rather than by any technical difficulty. After that, move blobs out, paginate, and truncate long text in list views.

Related tools in Developer & Code

Browse all Developer & Code tools
The person who builds ecech., at the desk where the tools are written.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.