Hi,
I have the following issue:
I have this JSON input:
{
"products": {
"10101702": {
"sku": "10101702",
"warehouse_products": {
"warehouse_1": {
"warehouse_id": "warehouse_1",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
},
"warehouse_12": {
"warehouse_id": "warehouse_12",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
}
}
},
"10102402": {
"sku": "10102402",
"warehouse_products": {
"warehouse_1": {
"warehouse_id": "warehouse_1",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
}
}
},
"10102503": {
"sku": "10102503",
"warehouse_products": {
"warehouse_1": {
"warehouse_id": "warehouse_1",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
}
}
}
}
}
I want a output like this:
{
"Inventroy": [
{
"warehouse_id": "warehouse_1",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
},
{
"warehouse_id": "warehouse_2",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
},
{
"warehouse_id": "warehouse_1",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
},
{
"warehouse_id": "warehouse_1",
"on_hand": 0,
"allocated": 0,
"backorder": 0,
"available": 0,
"non_sellable": 0
}
]
}
So loop over warehouse_products in products and add all warehouse_products childeren to a array.
Does anyone know how to do this?
@Gugi ?