Skip to main content
Turns a tree of nested items into a flat list. When your data has an item that contains child items, which in turn can contain their own children, use this to walk the whole tree and collect every item into one list. As it goes, it detaches the children from each parent, so each parent keeps only its own data and the children are lifted out alongside it.

Fields

Sample data

FieldValue
Child pathchildren
A category that holds two child categories. After flattening, the parent (with its children removed) and the list of children sit alongside each other in the result. Input:
{
    "id": "A",
    "name": "Clothing",
    "children": [
        { "id": "B", "name": "Shirts", "children": [] },
        { "id": "C", "name": "Trousers", "children": [] }
    ]
}
Output:
[
    { "id": "A", "name": "Clothing" },
    [
        { "id": "B", "name": "Shirts", "children": [] },
        { "id": "C", "name": "Trousers", "children": [] }
    ]
]