我得到了Json響應。我無法從string.my字符串獲取值是在android中簡單的Json解析
Json_response是
{"NameAllList":[{"Current":{"time":"2012-02-21T08:04:21","Name":"abcd"},
"Next":{"Name":"data1","StartTime":"2012-02-21T08:06:21"}},{"Current":{"time":"2012-02-21T08:14:21","Name":"defg"},
"Next":{"Name":"data2","StartTime":"2012-02-21T08:24:21"}},{"Current":{"time":"2012-02-21T08:28:21","Name":"ghij"},
"Next":{"Name":"data3","StartTime":"2012-02-21T08:34:21"}},{"Current":{"time":"2012-02-21T08:40:21","Name":"knmo"},
"Next":{"Name":"data4","StartTime":"2012-02-21T08:48:21"}}]}
和我想這一點。
JSONObject jsonObj = new JSONObject(json_response);
JSONObject subObj = jsonObj.getJSONObject("Current");
String name_current =subObj.getString("Name");
但我無法獲得「名稱」的價值。我做了什麼錯誤。提供鏈接進行上述解析。
你怎麼能沒有這樣的字符串轉義序列創建字符串變量? – 2012-02-21 06:49:17
你不能。所以我編輯過。 – Dray 2012-02-21 11:09:43