title: Retrofit How to build response class to get data from list nested object json
body: <p>I'm using retrofit to get response json from nodejs (as API) to my Android app.
  It works fine until I get this nested list object json.   </p>
  
  <pre><code>{
      "Profiles": [
      {
          "Firstname": "Alex",
          "Lastname": "Ho",
          "id": "5448cc75ced7cc8c050f4f0d"
      },
      {
          "Firstname": "Eli",
          "Lastname": "Tran",
          "id": "54491e5c5c3624c816d1ecd4"
      }], 
      "Status": "Success" 
  }
  </code></pre>
  
  <p>I have tried some ways to build object response like this but it doesn't work.</p>
  
  <h2>ListFriendProfileResponse.java</h2>
  
  <pre><code>public class ListFriendProfileResponse {
      @SerializedName("Profiles")
      @Expose
      private List&lt;Profile&gt; profiles = new ArrayList&lt;Profile&gt;();
  
      @SerializedName("Status")
      @Expose
      private String status;
  
      public List&lt;Profile&gt; getProfiles() {
          return profiles;
      }
  }
  </code></pre>
  
  <h2>Profile.java</h2>
  
  <pre><code>public class Profile {
      @SerializedName("Firstname")
      @Expose
      private String firstname;
  
      @SerializedName("Lastname")
      @Expose
      private String lastname;
      // ... 
  }
  </code></pre>
  
  <p>And retrofit to get data</p>
  
  <pre><code>@POST("/profile/getAll")
  void userGetAllProfile(@Body Object body, Callback&lt;ListFriendProfileResponse&gt; callback);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>@POST("/profile/getAll")
  void userGetAllProfile(@Body Object body, Callback&lt;List&lt;Profile&gt;&gt; callback);
  </code></pre>
  
  <p>The problem is json response doesn't fit to my java object. Could someone please advise me. Thanks</p>