title: Get JSON array from retrofit Response
body: <p>I need to parse JSON array from Retrofit. I need to get the following key:</p>
  
  <pre><code>{
    "rc":0,
    "message":"success",
    "he":[
      {
        "name":"\u05de\u05e4\u05e7\u05d7",
        "type":0
      }
    ]
  }
  </code></pre>
  
  <p>I can easily get the message but I am not able to get "he" array from response.</p>
  
  <p>Here is my data model class</p>
  
  <pre><code>public class GetRoleData implements Serializable {
  
      @SerializedName("he")
  
      private ArrayList&lt;Roles&gt; he;
  
      @SerializedName("message")
      private String message;
  
      public GetRoleData() {
          this.he = new ArrayList&lt;&gt;();
          this.message = "";
      }
  
      public ArrayList&lt;Roles&gt; getUserRoles() {
          return he;
      }
  
      public String getMessage() {
          return message;
      }
  
      public class Roles {
  
          public Roles() {
              name = "";
              type = -1;
          }
  
          @SerializedName("name")
  
          private String name;
          @SerializedName("type")
  
          private int type;
  
          public int getType() {
              return type;
          }
  
          public String getName() {
              return name;
          }
  
      }
  }
  </code></pre>
  
  <p>This is how I am sending request to the server:</p>
  
  <pre><code>@POST("index.php/")
  Call&lt;GetRoleData&gt; getUserRoles(@Body SetParams body);
  </code></pre>
  
  <p><strong>here is how i am sending request and handling response</strong></p>
  
  <pre><code>APIService apiService = retrofit.create(APIService.class);
  
          Call&lt;GetRoleData &gt; apiCall = apiService.getUserRoles(params);
          apiCall.enqueue(new Callback&lt;GetRoleData &gt;() {
  
  
              @Override
              public void onResponse(retrofit.Response&lt;GetRoleData &gt; mUserProfileData, Retrofit retrofit) {
  
                  Log.e("locale info", "mUserProfileData = " + mUserProfileData.body().toString());
                  if (pDialog != null) {
                      pDialog.dismiss();
                  }
                  if (mUserProfileData.body().getMessage().equals("success")) {
  
                      Log.e("locale info", "user roles = " + mUserProfileData.body().getUserRoles().size());
  
                  } else {
                      Toast.makeText(RegisterActivity.this, getResources().getString(R.string.get_role_error), Toast.LENGTH_SHORT).show();
                  }
              }
  
              @Override
              public void onFailure(Throwable t) {
  
                  if (pDialog != null) {
                      pDialog.dismiss();
                  }
  
                  t.printStackTrace();
              }
          });
  </code></pre>
  
  <p><strong>What i want</strong></p>
  
  <p>I need to get the "he" array from above response. Please help Thanks.</p>
  
  <p>here is response that i am getting..</p>
  
  <p><a href="https://i.stack.imgur.com/8w5h9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8w5h9.png" alt="enter image description here"></a></p>