有这样一个对象
var wrap_group = [
{
value: 'A',
group: [
{
value: '1',
group: [
{value: '12'}
]
},
{
value: '3',
group: [
{value: '10'}
]
}
]
},
{
value: 'B',
group: [
{
value: '2',
group: [
{value: '22'}
]
}
]
}
]
想把对象优雅的转换为一下形式的:
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'
},
请介绍下具体的思路和代码。