我正在JSONObject中獲取json webservice的結果。打印這個jsonObject時,它會打印出精確的結果。我在,因爲我讀一個複雜的反應是在JSON遍歷到在android中使用Json webservices元素
{"FoodMenuRS"
:{"Status":"Success",
"TotalResults":2,
"Results":{"Items":
{"Item":[
{"@Id":"6","@Name":"Tea"},
{"@Id":"4","@Name":"Coffee"}
]}}}}
我在這裏讀通過的形式,這個結果獲取值的時間有問題,
JSONArray jsonArray = json.getJSONArray("Item");
我在這裏得到錯誤「沒有價值項目」
凡爲同時呼籲其他服務,這是格式簡單,我得到獲取價值,
{"earthquakes":
[{"eqid":"c0001xgp","magnitude":8.8,"lng":142.369,"src":"us","datetime":"2011-03-11 04:46:23","depth":24.4,"lat":38.322},
{"eqid":"2010xkbv","magnitude":7.5,"lng":91.9379,"src":"us","datetime":"2010-06-12 17:26:50","depth":35,"lat":7.7477}]}
我把它叫做使用,
JSONArray earthquakes = json.getJSONArray("earthquakes");
請幫助如何獲取這種類型的JSON響應的。提前致謝。
成功地感謝。 – rajesh