我得到了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