-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Description
hi @Courela
trying to find some nested loop kind of functionality to flatten below parent-child structure. Can you suggest how to proceed on this:
Input:
{
"Path": "Type1",
"Children": [
{
"Path": "Type1~Cat1",
"Items": [
{ "Id": "66717101" },
{ "Id": "66717102" }
],
"Children": [
{
"Path": "Type1~Cat1~Sku1",
"Items": [ { "Id": "66717101" } ],
"Children": [
{
"Path": "Type1~Cat1~Sku2~Model1",
"Items": [ { "Id": "66717102" } ]
},
{
"Path": "Type1~Cat1~Sku1~Model1",
"Items": [ { "Id": "66717101" },
{ "Id": "66717102" } ]
}
]
},
{
"Path": "Type1~Cat1~Sku2",
"Items": [ { "Id": "66717101" } ],
"Children": [
{
"Path": "Type1~Cat1~Sku2~Model1",
"Items": [ { "Id": "66717722" } ]
}
]
}
]
},
{
"Path": "Type1-Cat2",
"Children": []
},
{
"Path": "Type1-Cat3",
"Children": []
}
],
"Items": [ { "Id": "66717766" },
{ "Id": "6828147" } ]
}
Output:
[
{
"Id": "66717101",
"Path": [
"Type1~Cat1",
"Type1~Cat1~Sku1",
"Type1~Cat1~Sku2~Model1",
"Type1~Cat1~Sku2"
]
},
{
"Id": "66717102",
"Path": [
"Type1~Cat1",
"Type1~Cat1~Sku2~Model1",
"Type1~Cat1~Sku1~Model1"
]
},
{
"Id": "66717722",
"Path": [
"Type1~Cat1~Sku2~Model1"
]
},
{
"Id": "66717766",
"Path": [
"Type1"
]
},
{
"Id": "6828147",
"Path": [
"Type1"
]
}
]
Metadata
Metadata
Assignees
Labels
No labels