Nested Array Inventory: Path, Count and Depth Stats Before Splitting
Loading workflow…
Workflow Description
A fully local workflow that turns any nested JSON payload into a precise inventory of every array it contains. A Code node walks the structure recursively and records, for each array, its full dot/bracket path, element count, path depth, array nesting depth and element kind. An IF node separates non-empty paths from empty and invalid ones, a Set node creates an array-typed field ready for splitting only for non-empty paths, a Merge node in append mode joins both branches, and a final Code node emits one sorted report item with no network calls.
How it works
- 1.Manual Trigger starts the run with an empty item
- 2.A Code node emits two demo payloads: a valid nested order and an invalid null payload
- 3.A Code node walks the structure recursively and emits one item per array path with stats
- 4.An IF node checks itemCount > 0 and routes the paths
- 5.A Set node adds array-typed splitField plus splitFieldName while keeping other fields
- 6.A NoOp node collects empty and invalid paths
- 7.Merge (append, 2 inputs) joins both branches in one execution
- 8.A final Code node (runOnceForAllItems) returns a single alphabetically sorted inventory report
Use cases
- Inspect a nested API payload before building Split Out nodes
- Detect empty arrays that break splitting
- Measure array nesting depth to plan how many unwrap stages are needed
- Document a response structure for a development team
Requirements
- n8n 2.47.7 or compatible
- No credentials and no network access needed
- For real data: replace the sample Code node with a Webhook or HTTP Request node exposing a payload field
Setup and testing in n8n
- Import the JSON into n8n
- Run Execute Workflow and open the Build Inventory Report output
- Confirm seven array paths plus one invalid-payload row appear
- Add another empty array to the sample payload and verify it appears only in emptyArrayPaths
- Pass payload: null or a string to verify invalidPayloads increases
Service Value
Ready-made workflow template for automation delivery and service execution.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (8)
Manual Trigger
Manual Trigger
Load Sample Payloads
Code
Inventory Array Paths
Code
Has Elements?
If
Prepare Split Field
Set
Empty Or Invalid Paths
No Op
Merge Both Branches
Merge
Build Inventory Report
Code
Note Input Stage
Sticky Note
Note Inventory Stage
Sticky Note
Note Routing And Report
Sticky Note
Fresh workflows, straight to your inbox
Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.
- New workflows
- Clear overviews
- Setup guides