OhMyCalc

API Payload Size Calculator

Estimate JSON API payload size and gzip-compressed size from field count, average field size, array items, and nesting depth.

How to Use the Payload Size Calculator

  1. Enter number of JSON fields.
  2. Enter average field size in bytes.
  3. Enter number of array items.
  4. Enter nesting depth.
  5. Click Calculate to get estimated payload and compressed size.

使用场景

公式

Raw size = fields × avg field size × (1 + array items × 0.1) × nesting overhead. Compressed ≈ raw × 0.30 (gzip ~70% compression).

常见问题

How much does gzip compress JSON?
Gzip typically compresses JSON by 60–80% due to its high text repetition, resulting in 20–40% of original size.
What is a good API payload size?
Keep payloads under 100 KB for good performance. Paginate large lists and use field selection to reduce payload size.
Should I use MessagePack instead of JSON?
MessagePack is 20–50% smaller than JSON for binary data, but JSON is more debuggable and universally supported.