How to read below JSON data from API using retrofit? from struts and hibernate service,i am getting and sending data using Bean class from api [duplicate]

You have json array so you need to read like below

  try {

        JSONArray jsonArray=new JSONArray("your data");

        if(jsonArray.length()>0){

            for(int i=0;i<jsonArray.length();i++){
                JSONObject jsonObject=jsonArray.getJSONObject(i);

                JSONObject messageObj=jsonObject.getJSONObject("message");
                String user_id=messageObj.getString("user_id");
                String user_type=messageObj.getString("user_type");
                ----and so on.

            }
        }
      } catch (Exception e) {
        e.printStackTrace();
    }

Leave a Comment