0
我有从服务器返回JSON对象的一个阵列(如下),的Android不能转换到的JSONObject错误
["{\"schedule\":{\"type\":\"times\"},\"videos\":{\"abc\":\"def\"}}","{\"schedule\":{\"type\":\"tod_repeat\",\"start\":\"00:09:00\"},\"videos\":{\"mk_320059\":{\"url\":\"http://m.mtvkatsomo.fi/?progId=320059\",\"siteId\":\"mk\"}}}"]
这似乎是有效的JSON按照JSONLint(http://jsonlint.com/)。但是在android系统,当我尝试将其转换为一个对象,我得到一个例外,
org.json.JSONException: Value {"schedule":{"type":"times"},"videos":{"abc":"def"}} at 0 of type java.lang.String cannot be converted to JSONObject
的相关代码,
if (resp != null) {
try {
JSONArray lists = new JSONArray(resp);
Log.d(CLASS_NAME, "STRING REP:"+lists.getJSONObject(0).toString()); // <-- at this line
} catch (JSONException e) {
e.printStackTrace();
}
}
好像我失去了一些东西在这里,我似乎无法人物摆脱这里的问题。任何帮助表示赞赏。
荡,不能相信我没赶上。谢谢! –