【发布时间】:2016-10-18 09:05:57
【问题描述】:
JSON 有问题 从https://proxyepn-test.epnbn.net/wsapi/epn 开始,我得到了一个 json
但是当我想显示单个数据时,例如“名称”。 控制台显示:
日志
org.json.JSONException: No value for Name
org.json.JSONException: Value status at 0 of the type java.lang.String can not be converted to JSONObject
你能帮帮我吗? 谢谢。
这是我的代码:
String test2 = test.execute(restURL).get().toString();
Log.i("result",test2);
JSONObject obj = new JSONObject(test2);
String data = obj.getString("data");
Log.i("testjson",data);
String pageName = obj.getJSONObject("data").getString("Name");
Log.i("testjsondata",pageName);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
【问题讨论】:
标签: android json parsing jsonobject