For example i have json looks like:
{
"data": [
{
"name": "one"
},
{
"name": "two"
}
]
}
For example i have object User with field name.
Is it possible write method which will parse data array to objects User?
something like
Call<List<User>> getUsers(@KeyPath("data"))
Now to do this, i need create a wrapper class something like
public class UsersWrapper {
@SerializeName("data")
public ArrayList<User> users;
}
and in service i do next
public interface Service {
@GET("users")
Call<UsersWrapper> getUsers()
}
But my all requests is just response with data but variable objects in array.
In this case i need create wrappers to any data requests. Pain :(
?