I have an HTTP call that returns an array that I wish to explode to form another array based on the “quantity” field value inside it.
Source:
[
{
"statusCode": 200,
"data": [
{
"id": 1150382118,
"allocations": [
{
"id": 761424755,
"line_items": [
{
"id": 957825696,
"quantity": 2,
"sellable": {
"id": 437432630
}
}
],
"allocation_package": {
"id": 541325783,
"allocation_id": 761424755,
"depth": 22.4,
"height": 9.5,
"weight": 145.61,
"width": 9.8,
"weight_unit": "oz",
"dimensions_unit": "inches"
},
}
]
}
]
}
]
I want to transform it into:
[
{
"sellable_id": 1392380326
"quantity": 1
},
{
"sellable_id": 1392380326
"quantity": 1
},
]
Since the original data had “quantity” = 2 inside the “line_items” array, the new array should have 2 objects with “quantity” = 1 and the id inside the sellable object.
Using an iterator and JSON aggregator can create the correct structure for the new array, but since the “allocations” array only had 1 element, it doesn’t work. How can I do something like a for loop in Make.com based on the “quantity” field?
Solved:
Added a repeater then filter to break the loop

