> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bringits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Recursive JSON With Parent

> Extract deeply nested child elements while preserving their parent-child hierarchy

The Recursive JSON With Parent command (Command Type: 1006) extracts deeply nested child elements while preserving their parent-child hierarchy. It traverses the structure up a configurable number of levels to include ancestor context.

## Overview

The Recursive JSON With Parent command provides functionality for:

* Recursively traversing nested JSON structures
* Preserving parent context at a configurable number of levels
* Identifying child elements by a specified property key

## Command Type

**Command Type ID:** 1006

## Parameters

| Parameter       | Type   | Description                                                                      | Required |
| --------------- | ------ | -------------------------------------------------------------------------------- | -------- |
| **property**    | string | The property key in the JSON object used to identify child elements              | Yes      |
| **parentLevel** | number | Determines how many levels up the hierarchy to include in the returned structure | Yes      |

## Usage Examples

### Extract Children with One Parent Level

```json theme={null}
{
  "command": "recursive-json-with-parent",
  "params": {
    "property": "children",
    "parentLevel": 1
  }
}
```

### Extract with Two Parent Levels

```json theme={null}
{
  "command": "recursive-json-with-parent",
  "params": {
    "property": "items",
    "parentLevel": 2
  }
}
```

### Traverse Nested Categories

```json theme={null}
{
  "command": "recursive-json-with-parent",
  "params": {
    "property": "subcategories",
    "parentLevel": 1
  }
}
```

## Common Use Cases

* **Tree Traversal**: Flatten recursive tree structures (e.g. categories, menus, org charts)
* **Hierarchy Extraction**: Pull leaf nodes out of deep nesting while retaining parent context
* **Data Normalization**: Convert nested recursive JSON into flat records with ancestry

## Related Commands

* [Json Path](/stream/commands/parse/json-path) - Extract elements from JSON structures
* [Key Mapping](/stream/commands/parse/key-mapping) - Remap fields after extraction
* [Insert To Children](/stream/commands/parse/insert-to-children) - Inject parent data into children
