我们有一个复杂的json结构,我们需要在Android中进行解析。在Android中解析复杂的嵌套json数组/对象
{
"StatusCode":0,
"StatusInfo":"Processed and Logged OK",
"Schools":[
{
"Id":"1",
"Name":"School 1",
"Class":[
{
"Id":"11",
"Name":"Class 1",
"Section":[
{
"Id":"12",
"Name":"Section A"
},
{
"Id":"13",
"Name":"Section B"
},
{
"Id":"14",
"Name":"Section C"
}
]
},
{
"Id":"21",
"Name":"Class 2",
"Section":[
{
"Id":"22",
"Name":"Section A"
},
{
"Id":"23",
"Name":"Section B"
}
]
}
]
},
{
"Id":"5",
"Name":"School 2",
"Class":[
{
"Id":"51",
"Name":"Class 1",
"Section":[
{
"Id":"512",
"Name":"Section A"
},
{
"Id":"513",
"Name":"Section B"
},
{
"Id":"514",
"Name":"Section C"
}
]
},
{
"Id":"52",
"Name":"Class 2",
"Section":[
{
"Id":"522",
"Name":"Section A"
},
{
"Id":"523",
"Name":"Section B"
}
]
}
]
}
]
}
我已经检查了JSON在Android中解析各种教程,但我得到了这种结构相混淆,因为它再利用在各种阵列的名称。我想检查一下使用像GSON/Jackson这样的库来解析这个json结构是否容易。
此外,如果这个结构很大,每次解析这个结构时会占用更多的内存和性能问题,以便每次找到一个节点?
Regards, Aravind。 ç
2011-06-09
Ara