我有一个像这样的 json 对象:
[{
"id": 1,
"text": "Item 1",
"iconCls": "icon-ok",
"target": {
"jQuery180016273543753015074": 16
},
"checked": false,
"state": "open",
"children": [{
"id": 2,
"text": "Item 1_1",
"target": {
"jQuery180016273543753015074": 15
},
"checked": false,
"state": "open",
"children": [{
"id": 3,
"text": "Item 1_1_1",
"target": {
"jQuery180016273543753015074": 14
},
"checked": false,
"state": "open",
"children": [{
"id": 7,
"text": "Item 1_1_1_1",
"target": {
"jQuery180016273543753015074": 13
},
"checked": false
},
{
"id": 6,
"text": "Item 1_1_1_2",
"target": {
"jQuery180016273543753015074": 12
},
"checked": false
}]
}]
},
{
"id": 8,
"text": "Item 1_1_2",
"target": {
"jQuery180016273543753015074": 11
},
"checked": false,
"state": "open",
"children": [{
"id": 4,
"text": "Item 1_1_2_1",
"target": {
"jQuery180016273543753015074": 10
},
"checked": false
},
{
"id": 5,
"text": "Item 1_1_2_2",
"target": {
"jQuery180016273543753015074": 9
},
"checked": false
}]
},
{
"id": 9,
"text": "Item 1_1_3",
"target": {
"jQuery180016273543753015074": 17
},
"checked": false
}]
}]
我需要使用 java 在 RDF 本体中对其进行序列化,从而将子级的层次结构保持为“子类”属性。任何人都可以建议一种有效的算法来解析 JSON 吗?我使用实验室的内部 java API 来处理本体,因此在这种情况下,算法而不是代码会更有帮助。