I am returning an array of results with my json Objects, and I am trying to use my customObjectResponse class to pull out each of the fields within each of the objects... th
This can also work by just passing an array of response objects. So if this is your response object:
public class CustomUserResponse {
public String firstName;
public String lastName;
...
}
You can use related syntax, depending on how you use the callbacks. Such as:
new Callback(){
@Override
public void success(CustomUserResponse[] customUserResponses, Response rawResponse) {
}
@Override
public void failure(RetrofitError error) {
}
};
OR
public class GetUserCommand implements Callback { ...
Put simply, in every place where you normally replace T with a response class, replace it with an array, instead as in CustomUserResponse[].
NOTE: to avoid confusing errors, be sure to also use an array in the Retrofit interface definition:
@POST ( "/users" )
public void listUsers(@Body GetUsersRequest request, Callback callback);