Hi I have got a response from a query.The response is like:
{ data: [
{
parent: "summer",
image: "template/assets/x354.jpg",
productName: "United Colors of Benetton" }, { parent: "autumn", image: "template/assets/x354.jpg", productName: "United
Colors of Benetton" }, { parent: "summer", image:
"template/assets/x354.jpg", productName: "Puma Running Shoes" } ] }
Basically I want a function in php to format this response.The identical parent in the response in this case it is "summer",the data of the summer should print under it.i.e summer should be the parent of the data.The desired response is:
{ data: [
{
parent: "autumn",
image: "template/assets/x354.jpg", productName: "United Colors of Benetton" }, { parent: "summer" [{ image:
"template/assets/x354.jpg", productName: "United Colors of Benetton"
}, { image: "template/assets/x354.jpg", productName: "Puma Running
Shoes" } ] }
] }