Retrofit Expected BEGIN_OBJECT but was BEGIN_ARRAY

Right now you are parsing the response as if it was formatted like this:

{
  "contacts": [
    { .. }
  ]
}

The exception tells you this in that you are expecting an object at the root but the real data is actually an array. This means you need to change the type to be an array.

The easiest way is to just use a list as the direct type in the callback:

@GET("/users.json")
void contacts(Callback<List<User>> cb);

Leave a Comment