I'm sending an array of integers to the backend via this Retrofit interface:
@PATCH("save/ids")
@FormUrlEncoded
Call<Output> saveIds(@Field("ids[]") List<Integer> ids);
Now this works when I have an ArrayList with some items.
But to reset all the ids the servers wants an empty array called ids.
When I send an empty array, Retrofit doesn't send the array - it just drops the parameter.
I create my ArrayList as follows:
List<Integer> ids = new ArrayList<>();
for (FooObjects object : listOfIds) {
if (object.isEnabled()) {
ids.add(object.getId());
}
}
How can I send an empty array anyway?