how to fetch data from array inside array : I have to fetch value from array inside array. I can fetch values from first array but not able to fetch values from second array.



 JSONObject jsono = new JSONObject(res);
                    JSONArray jarray = jsono.getJSONArray("data");

                    for (int i = 0; i < jarray.length(); i++) {
                        JSONObject object = jarray.getJSONObject(i);

                        JSONArray jarray1 = object.getJSONArray("comments_data");

                        for (int j = 0; j < jarray1.length(); j++) {
                            JSONObject object1 = jarray1.getJSONObject(j);

                             String Namee = object1.getString("username");
                             String Ratingg = object1.getString("rating");
                             String Commentt = object1.getString("comment");


                            Comments comments1 = new Comments();


                            comments1.setUsername(Namee);
                            comments1.setRating(Ratingg);
                            comments1.setComments(Commentt);
                            comments1.setProfileimage(R.drawable.fav);


                            commentsList.add(comments1);

                        }
                    }



And this is my json.


{
    "status": "success",
    "msg": " Menu Details",
    "data": [
        {
            "id": "1",
            "rest_id": "1",
            "menu_rate": "100",
            "collection_time": "2:22pm",
            "quantity_left": "3",
            "food_type": "veg",
            "img1": "",
            "img2": "",
            "img3": "",
            "date": "",
            "menu_name": "",
            "comments_data": [
                {
                    "id": "20",
                    "user_id": "127",
                    "res_id": "1",
                    "comment": "shreyansh s",
                    "date": "0000-00-00 00:00:00",
                    "rating": "0.0",
                    "username": "lucky",
                    "userimage": "123"
                },
                {
                    "id": "19",
                    "user_id": "126",
                    "res_id": "1",
                    "comment": "das",
                    "date": "0000-00-00 00:00:00",
                    "rating": "3.0",
                    "username": "shrey srivastava",
                    "userimage": "123"
                },
                {
                    "id": "18",
                    "user_id": "126",
                    "res_id": "1",
                    "comment": "",
                    "date": "0000-00-00 00:00:00",
                    "rating": "3.0",
                    "username": "shrey srivastava",
                    "userimage": "123"
                },
                {
                    "id": "17",
                    "user_id": "126",
                    "res_id": "1",
                    "comment": "sakjbdkjasbk",
                    "date": "0000-00-00 00:00:00",
                    "rating": "3.0",
                    "username": "shrey srivastava",
                    "userimage": "123"
                },
                {
                    "id": "16",
                    "user_id": "107",
                    "res_id": "1",
                    "comment": "hello",
                    "date": "0000-00-00 00:00:00",
                    "rating": "5",
                    "username": "shreyansh",
                    "userimage": ""
                },
                {
                    "id": "15",
                    "user_id": "107",
                    "res_id": "1",
                    "comment": "hello",
                    "date": "0000-00-00 00:00:00",
                    "rating": "5",
                    "username": "shreyansh",
                    "userimage": "123"
                },
                {
                    "id": "14",
                    "user_id": "107",
                    "res_id": "1",
                    "comment": "hello",
                    "date": "0000-00-00 00:00:00",
                    "rating": "5",
                    "username": "shreyansh",
                    "userimage": "123"
                },
                {
                    "id": "6",
                    "user_id": "82",
                    "res_id": "1",
                    "comment": "good",
                    "date": "0000-00-00 00:00:00",
                    "rating": "",
                    "username": "jaim",
                    "userimage": "google.com"
                }
            ]
        }
    ]
}