【发布时间】:2014-12-18 08:52:36
【问题描述】:
首先,我在这个网站上阅读了大量类似的问题,但没有一个能解决我的问题,所以
我有这个使用 php 创建的 json 文件:
{
"done":true,
"data":"[
{\"id\":\"5099\",\"user_id\":\"892\"},
{\"id\":\"5100\",\"user_id\":\"892\"}
....
]"}
现在在 java android 中我想解析它,但它给了我这个错误:JSON.TypeMismatch
这是我解析 json 文件的 android 代码:
//class from which I get the json in a JSONObject - works fine so far
JSONObject httpResult = itemHttpRequest.get("/fetch?currentList=&sort=recent&extra=");
try {
JSONArray httpData = httpResult.getJSONArray("data");
} catch (JSONException e) {
e.printStackTrace();
}
但它总是给我错误。
是不是因为我的 json 文件中的数据数组被引号包围了?
请帮忙
【问题讨论】: