title: Retrofit 2: Extract Value from Response Array
body: <p>Im trying to extract a value from the response body of my Get Call in retrofit 2. I want to extract evey "id" yet I cant call the getters from the Response class, i think it could have something to do with the [] in the response class, when i remove the [] its returns a jackson error so i seem to be stuck</p>
  
  <p><strong>Call:</strong></p>
  
  <pre><code>public interface RetrofitCallsGetFavourites {
  
  
  @GET("diagnosis/configuration")
  Call&lt;GetFavouritesReponse[]&gt; getDiagnosisFavourites (@Query("favourite") Boolean fave, 
  @Header("Authorization") String authHeader);
  
  }
  </code></pre>
  
  <p><strong>This is the method im using, it wont let me call any getters</strong></p>
  
  <pre><code>public class LoginApiStepDefinition extends TestBaseFix {
  
  Retrofit retrofit = super.buildRetrofit(super.buildOkHttpClient());
  RetrofitCallsLogin call = retrofit.create(RetrofitCallsLogin.class);
  RetrofitCallsGetFavourites favecall = retrofit.create(RetrofitCallsGetFavourites.class);
  
  
  
  
  
  @Then("I get the list of favourites with {string} and {string}")
  public void iGetTheListOfFavouritesWithAnd(String username, String password) throws Exception {
      String auth = "Bearer " + LoginApi(username,password);
      String list = favecall.getDiagnosisFavourites(true,auth).execute().body().toString();
      System.out.println(list);
  
  }
  }
  </code></pre>
  
  <p><strong>Response body class</strong></p>
  
  <pre><code>public class GetFavouritesReponse {
  
  @JsonProperty("id")
  private Integer id;
  @JsonProperty("version")
  private Integer version;
  @JsonProperty("createdDate")
  private Object createdDate;
  @JsonProperty("modifiedDate")
  private Object modifiedDate;
  @JsonProperty("rie")
  private Boolean rie;
  @JsonProperty("diagnosisName")
  private String diagnosisName;
  @JsonIgnore
  private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;();
  
  @JsonProperty("id")
  public Integer getId() {
      return id;
  }
  
  @JsonProperty("id")
  public void setId(Integer id) {
      this.id = id;
  }
  
  @JsonProperty("version")
  public Integer getVersion() {
      return version;
  }
  
  @JsonProperty("version")
  public void setVersion(Integer version) {
      this.version = version;
  }
  
  @JsonProperty("createdDate")
  public Object getCreatedDate() {
      return createdDate;
  }
  
  @JsonProperty("createdDate")
  public void setCreatedDate(Object createdDate) {
      this.createdDate = createdDate;
  }
  
  @JsonProperty("modifiedDate")
  public Object getModifiedDate() {
      return modifiedDate;
  }
  
  @JsonProperty("modifiedDate")
  public void setModifiedDate(Object modifiedDate) {
      this.modifiedDate = modifiedDate;
  }
  
  @JsonProperty("rie")
  public Boolean getRie() {
      return rie;
  }
  
  @JsonProperty("rie")
  public void setRie(Boolean rie) {
      this.rie = rie;
  }
  
  @JsonProperty("diagnosisName")
  public String getDiagnosisName() {
      return diagnosisName;
  }
  
  @JsonProperty("diagnosisName")
  public void setDiagnosisName(String diagnosisName) {
      this.diagnosisName = diagnosisName;
  }
  
  @JsonAnyGetter
  public Map&lt;String, Object&gt; getAdditionalProperties() {
      return this.additionalProperties;
  }
  
  @JsonAnySetter
  public void setAdditionalProperty(String name, Object value) {
      this.additionalProperties.put(name, value);
  }
  
  
  }
  </code></pre>
  
  <p><strong>Here is an example of what is returned, the call is working correctly i just cant parse the informaiton correctly, im trying to extract all the id's</strong></p>
  
  <pre><code>[ {
  "id" : 15,
  "version" : 0,
  "createdDate" : null,
  "modifiedDate" : null,
  "rie" : false,
  "diagnosisName" : "Angina pectoris - Angina pectoris with documented spasm"
  }, {
  "id" : 14,
  "version" : 0,
  "createdDate" : null,
  "modifiedDate" : null,
  "rie" : false,
  "diagnosisName" : "Angina pectoris - Unstable angina"
  },{
  "id" : 22,
  "version" : 0,
  "createdDate" : null,
  "modifiedDate" : null,
  "rie" : false,
  "diagnosisName" : "Seropositive rheumatoid arthritis - Seropositive rheumatoid arthritis, unspecified                 
  Pelvic region and thigh"
  }, {
  "id" : 27,
  "version" : 0,
  "createdDate" : null,
  "modifiedDate" : null,
  "rie" : false,
  "diagnosisName" : "Test Diagnosis Cardiology"
  }, {
  "id" : 26,
  "version" : 0,
  "createdDate" : null,
  "modifiedDate" : null,
  "rie" : false,
  "diagnosisName" : "Test Diagnosis with Service"
  } ]
  </code></pre>