构造树型json_json树形结构解析的方法 -问答-阿里云开发者社区-阿里云
[{"id": "1","pid": "0","name": "1989-01-12","children": [{"id": "2","pid": "1","name": "企划分部二","children": [{"id": "3","pid": "2","name": "企划分部二 A组","children": [{"id": "4","pid": "3","name": "企划分部二 A
[
{
"id": "1",
"pid": "0",
"name": "1989-01-12",
"children": [
{
"id": "2",
"pid": "1",
"name": "企划分部二",
"children": [
{
"id": "3",
"pid": "2",
"name": "企划分部二 A组",
"children": [
{
"id": "4",
"pid": "3",
"name": "企划分部二 A组",
"__id": "r1004",
"__previd": "r1003",
"__index": 3,
"__pid": "r1003",
"__level": 4,
"__hasChildren": false,
"__status": "nochanged"
}
],
"__id": "r1003",
"__previd": "r1002",
"__index": 2,
"__pid": "r1002",
"__level": 3,
"__hasChildren": true,
"__status": "nochanged",
"__nextid": "r1004"
}
],
"__id": "r1002",
"__previd": "r1001",
"__index": 1,
"__pid": "r1001",
"__level": 2,
"__hasChildren": true,
"__status": "nochanged",
"__nextid": "r1003"
}
]
},
{
"id": "2",
"pid": "1",
"name": "企划分部二",
"children": [
{
"id": "3",
"pid": "2",
"name": "企划分部二 A组",
"children": [
{
"id": "4",
"pid": "3",
"name": "企划分部二 A组",
"__id": "r1004",
"__previd": "r1003",
"__index": 3,
"__pid": "r1003",
"__level": 4,
"__hasChildren": false,
"__status": "nochanged"
}
],
"__id": "r1003",
"__previd": "r1002",
"__index": 2,
"__pid": "r1002",
"__level": 3,
"__hasChildren": true,
"__status": "nochanged",
"__nextid": "r1004"
}
]
},
{
"id": "3",
"pid": "2",
"name": "企划分部二 A组",
"children": [
{
"id": "4",
"pid": "3",
"name": "企划分部二 A组",
"__id": "r1004",
"__previd": "r1003",
"__index": 3,
"__pid": "r1003",
"__level": 4,
"__hasChildren": false,
"__status": "nochanged"
}
]
},
{
"id": "4",
"pid": "3",
"name": "企划分部二 A组"
}
]
有这么一个json的树形结构,想用java去解析他,有没有什么好方法?
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)