{}JSONLint.app

JSON Size & Structure Analyzer

Get detailed insights into your JSON structure. Analyze size, depth, type distribution, and find optimization opportunities.

965 B
Loading...

Click "Analyze Structure" to see detailed statistics about your JSON.

Understanding JSON Size

JSON file size matters for performance. Large JSON payloads affect:

  • Network transfer time — Bigger files take longer to download
  • Parse time — Complex structures take longer to parse
  • Memory usage — Large objects consume more RAM
  • API costs — Many services charge by data transfer

Metrics Explained

Size Metrics

MetricDescription
Current sizeSize of your input as-is (may include whitespace)
MinifiedSize with all whitespace removed
Pretty printedSize with standard 2-space indentation
Compression potential% savings from minification

Structure Metrics

MetricDescription
Max depthDeepest nesting level (0 = flat)
Total valuesCount of all primitive and container values
Total keysNumber of object keys (including duplicates)
Unique keysNumber of distinct key names

Interpreting Results

High Compression Potential (>30%)

If your JSON has more than 30% compression potential, it's probably pretty-printed with lots of whitespace. Consider:

  • Minifying for production API responses
  • Enabling gzip compression on your server
  • The trade-off: readability vs. size

Deep Nesting (depth > 5)

Deeply nested JSON can indicate:

  • Complex data models that might be hard to work with
  • Potential for flattening to improve access patterns
  • Recursion risks when processing

Many Duplicate Keys

When total keys is much higher than unique keys, you have repeated structures. This is common in arrays of objects and is usually fine, but consider:

  • Shortening frequently-used key names
  • Using arrays instead of repeated objects for tabular data

Optimization Strategies

1. Minify for Production

// Before: 156 bytes
{
  "name": "John",
  "age": 30
}

// After: 24 bytes (85% smaller!)
{"name":"John","age":30}

Use our JSON Minify tool to compress your JSON.

2. Shorten Key Names

// Before
{"firstName": "John", "lastName": "Doe"}

// After
{"fn": "John", "ln": "Doe"}

In arrays with many objects, shorter keys provide significant savings.

3. Remove Unnecessary Data

  • Remove null/empty values when they're optional
  • Omit default values that can be assumed
  • Remove debugging/internal fields before sending to clients

4. Use Arrays for Tabular Data

// Before: Keys repeated for each object
[
  {"name": "Alice", "age": 30},
  {"name": "Bob", "age": 25}
]

// After: Keys specified once
{
  "columns": ["name", "age"],
  "rows": [["Alice", 30], ["Bob", 25]]
}

5. Enable Server Compression

Most production savings come from HTTP compression (gzip/brotli), not JSON minification. A 100KB JSON file might compress to 10KB over the wire.

Size Guidelines

SizeTypical Use CaseConcerns
<10 KBAPI responses, configsNone — this is ideal
10-100 KBData exports, larger responsesConsider pagination
100 KB - 1 MBBulk data transfersUse streaming, compression
>1 MBData dumps, backupsConsider alternative formats

Related Tools

Frequently Asked Questions

What's a good max depth?

For most APIs, 3-5 levels is typical. Deeper than 7-8 levels often indicates overly complex data models. However, some domains (like file systems or organizational hierarchies) naturally require deep nesting.

Does whitespace affect parse time?

Slightly, but the difference is usually negligible. The main benefit of minification is reduced transfer size, not parse speed.

Why analyze JSON size?

Understanding your JSON structure helps you make informed decisions about optimization, identify potential performance issues, and ensure your data models are appropriate for your use case.

Common Mistakes & Pro Tips

  • Bytes and characters are not the sameSize is measured in UTF-8 bytes, and any non-ASCII character (accented letters, emoji, CJK text) takes 2–4 bytes while counting as a single character. So a document's byte size can be noticeably larger than its character length — always budget storage and bandwidth in bytes.
  • Whitespace and indentation are pure overheadPretty-printing with 2- or 4-space indentation can add 20% or more to a document's size, all of it removable. Minifying (stripping insignificant whitespace) is lossless and often the single biggest, safest size win before you optimize anything else.
  • Repeated keys are where bloat hidesIn a large array of objects, every element repeats the full key names, so long descriptive keys multiply across thousands of rows. The per-key breakdown shows this clearly — shortening keys or switching to a columnar/array-of-arrays layout can dramatically shrink repetitive data.
  • Base64 blobs inflate size by about a thirdEmbedding an image or file as a Base64 string inside JSON makes that field roughly 33% larger than the raw binary, and it's often the single largest node. The largest-nodes view surfaces these quickly so you can decide whether to move them to a separate URL or attachment.

Frequently Asked Questions

Why is the byte size bigger than the character count?

JSON is stored as UTF-8, where ASCII characters use one byte each but accented letters, emoji, and CJK characters use two to four bytes. The analyzer counts actual UTF-8 bytes, which is what matters for storage, network transfer, and request-size limits, so it can exceed the visible character count.

How do I find what's making my JSON so large?

Use the largest-nodes and per-key breakdown views. They rank fields and subtrees by their byte contribution, so you can immediately spot an oversized array, a Base64 blob, or a repeated key set. From there you can decide what to trim, externalize, or restructure.

Will minifying my JSON reduce its size much?

It depends on how it's formatted. Removing indentation and newlines from a pretty-printed document is lossless and commonly saves 10–30%. If the data is already minified, the savings are negligible and you should look at repeated keys or large embedded values instead.

What does the depth measurement tell me?

Depth is how many levels of nesting the document reaches at its deepest point. Very deep structures can be slower to parse, harder to query, and may hit recursion limits in some parsers. If depth is unexpectedly high, it often signals an over-nested or accidentally wrapped structure worth flattening.

Does object key order or formatting affect the reported size?

Key order doesn't change byte size, but formatting does. Indentation, spaces after colons and commas, and trailing newlines all add bytes. The analyzer measures the document exactly as you paste it, so reformatting it changes the number even though the data is identical.

Is my document uploaded to measure it?

No. The analysis runs in your browser, counting bytes and walking the parsed tree locally. Nothing is transmitted, so you can safely measure production payloads and private data.