Hi, I’ve a nested array and required to flatten before sending back to the webhook. But I’ve encounter issue as I’m not good with js. Here is the sample nested array:
[
{
"value": [
{
"UID": "FDWM_1",
"Name": "1",
"OBID": "6GKS01SA"
},
{
"UID": "FDWM_2",
"Name": "2",
"OBID": "6GLE000A"
}
]
},
{
"value": [
{
"UID": "FBA_3",
"Name": "3",
"OBID": "6FLA001A"
}
]
},
{
"value": []
}
]
and the preferred transformed output:
[
{
"value": [
{
"UID": "FDWM_1",
"Name": "1",
"OBID": "6GKS01SA"
},
{
"UID": "FDWM_2",
"Name": "2",
"OBID": "6GLE000A"
}
{
"UID": "FBA_3",
"Name": "3",
"OBID": "6FLA001A"
}
]
}
]
I attempt to use Code node to clean up the structure and the empty result but couldn’t solve it. Need to use Run Once for All Items mode. I tried to use filter and reduce but doesn’t seems to work. My workflow as below and happy if either node able to solve the problem. Thanks.