JSON Nesting Depth Finder

Recursively walks a parsed JSON document to find its deepest point, reporting both the maximum nesting depth as a number and the dot/bracket path (same notation as JSON Object Flattener) that reaches it. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-24

Overview

Introduction

Deeply nested JSON can be hard to reason about just by scrolling through it, especially in a large, unfamiliar document.

This tool answers a simple but useful question directly: how deep does this document actually go, and where?

What Is JSON Nesting Depth Finder?

A structural inspector that recursively walks a parsed JSON value, tracking the deepest point reached and the exact path (in dot/bracket notation) to get there.

It reports a single number for the maximum depth plus the specific path, rather than a full depth-per-key breakdown.

How JSON Nesting Depth Finder Works

The tool parses the input, then recursively visits every object property and array item, computing each child's depth first and taking child.depth + 1 as the candidate depth at the current level.

It keeps the best (deepest) candidate seen so far at each branching point, only replacing it when a strictly greater depth is found, and carries the winning path back up to the caller alongside the depth number.

When To Use JSON Nesting Depth Finder

Use it before deciding whether a document needs Truncate JSON or JSON Object Flattener, both of which are more useful once you know how deep the nesting actually goes.

It's also handy for quickly sanity-checking an API response or config file that seems unexpectedly complex.

Features

Advantages

  • Reports both the depth number and the exact path that reaches it, not just a number.
  • Treats scalars and empty containers consistently (both as depth-1 leaves).
  • Handles arrays and objects uniformly using the same dot/bracket path notation as other tools in this category.

Limitations

  • Only the single deepest path is reported; if you need every path's depth, use JSON Object Flattener and inspect the resulting keys instead.
  • Very large documents with many branches still require a full recursive walk, so extremely large inputs may take a moment to process.

Examples

Finding the deepest path

Input

{"user":{"name":"Ada","address":{"city":"London"}},"tags":["a"]}

Output

Maximum depth: 4
Deepest path: user.address.city

The root object (1) contains user (2) which contains address (3) which contains the scalar city (4), the deepest point in the document.

Best Practices & Notes

Best Practices

  • Run this before choosing a maxDepth for Truncate JSON so the limit you pick is grounded in the document's actual shape.
  • Use the reported path to jump straight to the deepest part of a large document in your editor's search.
  • Re-run after editing a document to confirm a refactor actually reduced its nesting depth.

Developer Notes

The recursive findDeepest() function returns both a depth and a path together as one result, rather than depth alone, so the "best so far" comparison at each level can propagate the winning child's path upward without a second pass over the tree to locate it afterward.

JSON Nesting Depth Finder Use Cases

  • Deciding on a sensible maxDepth before truncating a large JSON document
  • Auditing how deeply nested an API response or config file really is
  • Quickly locating the single most deeply nested value in an unfamiliar document

Common Mistakes

  • Expecting a full list of every path's depth; this tool reports only the single deepest one.
  • Confusing "depth" here with "number of keys"; a document can have many keys but still be shallow if none are nested.

Tips

  • If two branches tie for maximum depth, the earlier one in the document (by key/array order) is the one reported.
  • Pair with JSON Analyzer for a fuller structural summary beyond just depth.

References

Frequently Asked Questions