toolgarden.xyz
中文

JSON Stats

Free online JSON / JSONC / JSON5 statistics tool to analyze nesting depth, key count, type distribution, and size comparison

Input JSON / JSONC / JSON5

Analysis will appear automatically after entering JSON / JSONC / JSON5

About this tool

JSON Stats walks the document recursively and measures original UTF-8 bytes, minified bytes, maximum nesting depth, total keys, object and array counts, value type counts, and the longest string. It describes structural scale rather than interpreting business meaning.

Original size includes source whitespace while minified size comes from serializing strict JSON again, so their difference estimates formatting overhead. Every node is visited, making time and memory grow with the number of values in a large document.

How to use it

  1. Paste the full document

    Enter strict JSON, JSONC, or JSON5 and let the parser establish that the structure is valid.

  2. Read structural metrics

    Use depth, key count, and object or array counts together rather than judging complexity from file size alone.

  3. Investigate unusual signals

    If the longest string, nesting depth, or a type count looks abnormal, inspect the producer of the source data.

Input and output example

A structural summary rather than the data itself. The size comparison tells you whether minifying is worth it.

JSON input
{
  "users": [
    { "id": 1, "tags": ["a"] },
    { "id": 2, "tags": [] }
  ]
}
Statistics
Max depth        4
Total keys       7
Types            object 3 / array 3 / number 2 / string 1
Formatted size   92 B
Minified size    54 B

Supported range and limits

What it reports
Maximum nesting depth, total key count, type distribution, array lengths, and formatted vs minified size
Main use
Sizing up unfamiliar data before deciding how to process it
Why depth matters
Deep nesting slows tree rendering and serialisation, and hints that the data model may need splitting
Why type distribution matters
One field holding different types across elements is usually a data-quality signal
Size comparison
Shows how much minifying saves, which tells you whether it is worth doing at the transport layer
What it does not do
Only measures; the input is never modified

When you would use it

  • Estimating an API payload

    Compare formatted and minified bytes and see whether repeated nesting is inflating the response.

  • Auditing generated data

    Use type distribution and longest-string output to spot unexpected nulls, embedded text blobs, or deep objects.

  • Deciding whether transport compression is worth it

    Comparing formatted against minified size tells you whether an endpoint needs minification or gzip enabled.

What to know before you start

  • Size uses UTF-8 bytes, so a Chinese character does not normally equal one byte.
  • Depth begins at the root value and can differ by one from libraries that call the root level one.
  • Statistics do not deduplicate repeated structures; every occurrence is traversed and counted.

Related concepts

UTF-8 byte size
The encoded byte length of text, which is closer to transfer size than JavaScript string length.
maximum depth
The number of nested levels on the deepest route from root to leaf, useful for spotting excessive complexity.

Frequently asked questions

What does JSON stats show?
It shows nesting depth, total key count, the distribution of types (string/number/object, etc.) and the data size, among other structural metrics.
What are these stats useful for?
They help you judge whether an API response is too bloated or poorly structured, or compare size and complexity before and after optimization.
Does analysis upload my data?
No. All statistics are computed locally in your browser and data is never uploaded.
How deep is too deep?
There is no hard rule, but past eight to ten levels the data model can usually be split. Greater depth raises the cost of tree rendering, serialisation and front-end access, and makes failures harder to localise.
What does the type distribution reveal?
The most valuable signal is one field holding different types across array elements; an id that is sometimes a number and sometimes a string. That inconsistency almost always causes a downstream bug, and it often never surfaces in a test environment.