[Solved] Android : parse a JSONArray


Here is your code to parse data,

private void parseData(){
        try {
            JSONArray jsonArray=new JSONArray(response);
            JSONObject jsonObject=jsonArray.getJSONObject(0);
            JSONArray jsonArrayNid=jsonObject.getJSONArray("nid");
            JSONArray jsonArrayUid=jsonObject.getJSONArray("uid");
            JSONArray jsonArrayField_image=jsonObject.getJSONArray("field_image");
            for(int i=0;i<jsonArrayNid.length();i++){
                JSONObject jsonObjectNid=jsonArrayNid.getJSONObject(i);
                String value=jsonObjectNid.getString("value"); //here you get your nid value
            }
            for(int i=0;i<jsonArrayUid.length();i++){
                JSONObject jsonObjectUid=jsonArrayUid.getJSONObject(i);
                String target_id=jsonObjectUid.getString("target_id"); //here you get your uid target_id value
                String url=jsonObjectUid.getString("url"); //here you get your uid url value
            }
            for(int i=0;i<jsonArrayField_image.length();i++){
                JSONObject jsonObjectFieldImage=jsonArrayField_image.getJSONObject(i);
                String target_id=jsonObjectFieldImage.getString("target_id");
                String alt=jsonObjectFieldImage.getString("alt");
                String title=jsonObjectFieldImage.getString("title");
                String width=jsonObjectFieldImage.getString("width");
                String height=jsonObjectFieldImage.getString("height");
                String url=jsonObjectFieldImage.getString("url");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

    }

3

solved Android : parse a JSONArray