This response is from one API call. JSON Response 1:
{
"message": "success",
"data": [
{
"storeid": "91",
"productid": "37",
"cartitemid": 48,
"product_quantity": 8
},
{
"storeid": "86",
"productid": "74",
"cartitemid": 52,
"product_quantity": 1
},
{
"storeid": "86",
"productid": "73",
"cartitemid": 51,
"product_quantity": 6
},
{
"storeid": "86",
"productid": "76",
"cartitemid": 50,
"product_quantity": 1
}
]
}
This is 2nd API call.
JSON Response 2:
{
"data": [
{
"storeid": 91,
"productid": 37,
"product_name": "hhh"
},
{
"storeid": 86,
"productid": 73,
"product_name": "dfsdfsd"
},
{
"storeid": 86,
"productid": 76,
"product_name": "dfsdfsd"
}
]
}
I need this output because I need to parse this json into my model.
And OUTPUT:
{
"storeInfo": [
{
"storeid": 91,
"products": [
{
"productid": 37,
"product_name": "hhh",
"prod_images": "https://sdfsd.com"
}
]
},
{
"storeid": 86,
"products": [
{
"productid": 73,
"product_name": "ghgjhhj",
"prod_images": "https://hjhjh.com"
},
{
"productid": 76,
"product_name": "reer",
"prod_images": "https://hjhjh.com"
}
]
}
]
}
Please suggest how I can make the output JSON in this format? I have tried many way to merge two json and make it output to this way. Nothing worked out. Does this suppose to be happened on backed or it is in our frontend hands?
prod_imagescomes from in the OUTPUT?