我有一个 web 服务的响应来获取提要列表,在该响应中我得到了两个具有相同名称的数组。问题是我无法获得内部数组的详细信息,即“ProfileName”、“ImageUrl”等。
我已经尝试过json解析。
下面是 JSON 的响应:
{"Status":true, "result": [ {"result": [ {"ProfileName":"followers5","ImageUrl":"http:\/\/192.168.0.1\/webservice2\/uploads\/81.png","Likes":3,"Hearts":2}, {"ProfileName":"followers5","VideoUrl":"http:\/\/192.168.0.1\/webservice2\/uploads\/81.mp4","Likes":0,"Hearts":0} ]} ,{"result":[ {"ProfileName":"followers6","ImageUrl":"http:\/\/192.168.0.1\/webservice2\/uploads\/82.png","Likes":0,"Hearts":2}, {"ProfileName":"followers6","VideoUrl":"http:\/\/192.168.0.1\/webservice2\/uploads\/82.mp4","Likes":0,"Hearts":0} ]} ] }
我试过如下:
class feedtask extends AsyncTask<String, Integer, String> { @Override protected String doInBackground(String... params) { Httputils getmethod = new Httputils(); try { result = getmethod.Getrequest("feeds.php?uid=76"); System.out.println("Feeds Result--->" + result); JSONObject jobj = new JSONObject(result); JSONArray ja = jobj.getJSONArray("result"); for (int i = 0; i < ja.length(); i++) { for (int j = 0; j <= i; j++) { JSONObject jo = ja.getJSONObject(j); abcd.add(jo.getString("ProfileName")); System.out.println("Profile Name--->" + jo.getString("ProfileName")); } } } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } }
请帮助我获取第二个数组的详细信息。
任何帮助将不胜感激。
谢谢你。