there is such an object
var wrap_group = [
{
value: "A",
group: [
{
value: "1",
group: [
{value: "12"}
]
},
{
value: "3",
group: [
{value: "10"}
]
}
]
},
{
value: "B",
group: [
{
value: "2",
group: [
{value: "22"}
]
}
]
}
]
want to gracefully convert the object to the following form:
wrap_group = [
{
building_number: "A",
floor_number: "1",
room_number: "12"
},
{
building_number: "A",
floor_number: "3",
room_number: "10"
},
{
building_number: "B",
floor_number: "2",
room_number: "22"
},
]
Please introduce the specific ideas and codes.