{
"1": {
"group": "Clothes",
"brand": {
"0": {
"brand_id": "12",
"brand_name": "Adidas"
},
"1": {
"brand_id": "15",
"brand_name": "Zara"
}
}
},
"2": {
"group": "Cars",
"brand": {
"0": {
"brand_id": "43",
"brand_name": "Ferrari"
},
"1": {
"brand_id": "51",
"brand_name": "BMW"
}
}
}
}
And this is it, what I want to get
{0: {
brand_id: "12",
brand_name: "Adidas",
group: "Clothes",
}
1: {
brand_id: "15",
brand_name: "Zara",
group: "Clothes",
},
2: {
brand_id: "43",
brand_name: "Ferrari",
group: "Cars",
}
3: {
brand_id: "51",
brand_name: "BMW",
group: "Cars",
}}
我尝试使用.reduce()
或.map()
,但效果不佳。