๐ŸชœJSON Depth and Size Analyzer

Measure depth, nodes and the deepest path

Key nameOccurrences

Depth is measured with an explicit stack in a loop rather than recursion, so very deeply nested documents cannot blow the call stack. Limits of 1,000 levels and 200,000 nodes still apply and anything past them is refused. JSON cannot contain circular references, so no cycle check is performed.

You Might Also Need

How to use the JSON depth and size analyzer

Paste a JSON document and the page reports its maximum nesting depth and the path that reaches it, the total node count, how many key occurrences and distinct key names it holds, the longest array, a tally by value type, and the byte size before and after whitespace is removed. The deepest path is given in $.a[0].b form so you can jump straight to it.

How the analysis works

Parsing uses the browser JSON.parse, and on failure the page names the line and column where it stopped. The walk is a loop over an explicit stack rather than a recursive function, so deep nesting never overflows the call stack. Byte counts come from UTF-8 encoding with TextEncoder, and the whitespace-free figure re-encodes the JSON.stringify output. As of October 2026.

Limits worth knowing

Limits of 1,000 levels and 200,000 nodes keep the page responsive, and input past them is refused. The JSON format has no circular references, so no cycle check is done. When a key is duplicated inside one object JSON.parse keeps only the last value, so duplicates do not show up in the tally. Transfer size after compression and parsing time are not estimated.

Frequently Asked Questions

How is depth counted?

A document holding a single value counts as 0, and every object or array you open adds one level. So 5 is 0, {"a":1} is 1, and {"a":{"b":1}} is 2. The rule in force is printed with the results.

Can it handle very deeply nested JSON?

Yes. The walk uses an explicit stack in a loop instead of recursion, so deep nesting cannot overflow the call stack. Limits of 1,000 levels and 200,000 nodes still apply so the page never freezes, and anything past them is refused with a message.

What does this tool not do?

It does not pretty-print JSON or validate it against a schema, and it does not estimate transfer time or compressed size. It computes structural metrics and byte sizes only.