[{
"id": 1,
"name": "A",
"children": [{
"id": 2,
"name": "A1"
}]
}]
根据
id->value
name->label
children->sub
映射关系
变成
[{
"value": 1,
"label": "A",
"sub": [{
"value": 2,
"label": "A1"
}]
}]
数据结构可能嵌套得很深,希望以最简单可靠的方式实现,我想过直接替换,但是如果值也有id、name、children字样,会替换错误。
- 4
新手上路,请多包涵使用 fastjson 映射对象吧,这个是可用的