所以我有一個JSONObject(或字符串..),看起來像這樣:在Java中重新解析JSON對象?
{"locations":[{"GeocodeResponse":{"result":{"formatted_address":"Tchibanga (TCH), Gabon","address_component":[{"long_name":"Tchibanga","type":
["airport","establishment","transit_station"],"short_name":"Tchibanga"},{"long_name":"Mougoutsi","type":
["administrative_area_level_2","political"],"short_name":"Mougoutsi"},{"long_name":"Nyanga","type":
["administrative_area_level_1","political"],"short_name":"Nyanga"},{"long_name":"Gabon","type":
["country","political"],"short_name":"GA"}],"type":["airport","establishment","transit_station"],"geometry":
{"viewport":{"southwest":{"lng":"10.9968524","lat":"-2.8198146"},"northeast":{"lng":"11.0031476","lat":"-2.8135194"}},"location_type":"APPROXIMATE","location":{"lng":"11","lat":"-2.816667"}}},"status":"OK"}}]}
這不過了太多的信息,我只想說
{"locations":[{"id":"Tchibanga(TCH)","parentId":"TCH","airport":"Tchibanga","category":"Airport","location":{"longitude":"11","latitude":"-2.816667"},"name":"Nyanga","country":"GA"}]}
我怎麼會去到正確解析這個?
編輯:不,我不想讓另一個庫來解析它。
你看過使用json.org的JSON庫嗎? – 2010-09-28 12:51:18
TMI,以什麼方式?你想過濾掉東西,重寫JSON還是其他的東西?是的,你確實需要另一個lib,而不是來自org.json的概念驗證。即使你還不知道你需要它:) – StaxMan 2010-09-29 04:00:50