Skip to content

Main content

JSON Path Array Depth Tool

Count array traversals in explicit path segment kinds, without guessing whether numeric keys identify arrays.

Loading tool…

Description

Require every segmentKinds entry to be object or array and count the array entries as arrayDepth.

JSON Pointer separates path tokens with slashes and escapes literal slash and tilde inside member names. The empty pointer denotes the document root; an empty token can name an actual empty-string member.

Require every segmentKinds entry to be object or array and count the array entries as arrayDepth.

When to use this tool

Use JSON Path Array Depth when you need a pointer token, depth, or representation check.

How to use the tool and how it works

  1. Enter segmentKinds. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read arrayDepth. Use the output convention below.

Require every segmentKinds entry to be object or array and count the array entries as arrayDepth.1

Input fieldMeaning and unitsAccepted input
segmentKindsSegment KindsRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
Output fieldInterpretationReturned shape
arrayDepthArray DepthRequired. Safe integer.
json
{
  "input": {
    "segmentKinds": [
      "object",
      "array",
      "array"
    ]
  },
  "output": {
    "arrayDepth": 2
  }
}

Limitations and assumptions

  • Container kinds are caller supplied; the tool does not parse a path or inspect a JSON document.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a complete pointer parser and resolve against the actual document when existence or array access matters.

References

  1. Calculation and input contract: json/json-path-array-depth — tool.io

Similar or alternative tools