数据 A:
[
{
"id":340,
"name":"门类",
"sub":[
{
"id":341,
"name":"房门"
},
{
"id":367,
"name":"门类配件",
"children":[
{
"id":427,
"name":"门锁"
}
]
}
]
}
]
数据 B:
[
{
"id":340,
"name":"门类",
"sub":[
{
"id":342,
"name":"卫生间门"
},
{
"id":367,
"name":"门类配件",
"children":[
{
"id":428,
"name":"门吸"
}
]
}
]
},
{
"id":344,
"name":"洁具/卫浴",
"sub":[
{
"id":347,
"name":"马桶"
},
{
"id":363,
"name":"卫浴五金",
"children":[
{
"id":421,
"name":"龙头套装"
}
]
}
]
}
]
数据 B 合并到数据 A 结果:
[
{
"id":340,
"name":"门类",
"sub":[
{
"id":341,
"name":"房门"
},
{
"id":367,
"name":"门类配件",
"children":[
{
"id":427,
"name":"门锁"
},
{
"id":428,
"name":"门吸"
}
]
},
{
"id":342,
"name":"卫生间门"
}
]
},
{
"id":344,
"name":"洁具/卫浴",
"sub":[
{
"id":347,
"name":"马桶"
},
{
"id":363,
"name":"卫浴五金",
"children":[
{
"id":421,
"name":"龙头套装"
}
]
}
]
}
]