我們有一個複雜的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。 ç
Thnx JsonGen給了我一種尋找這個json結構的新方法。 – Ara 2011-06-09 13:02:23