I am trying to send a String[]
array as a name value pair in a HashMap to the backend but the backend receives the payload as follows:
Parameters: {"gallery_file_ids"=>"[Ljava.lang.String;@4acac2e"}
The array values are not sent and also an additional "" is surrounding the array value. Here's my code:
Setting up the array:
String[] gallery_array = new String[2];
gallery_array[0] = "2134564";
HashMap<String, Object> params = new HashMap<>();
params.put("gallery_file_ids", gallery_array);
Retrofit API
@FormUrlEncoded
@PATCH("api/profile.json")
Call<Profile> updateProfile(@FieldMap HashMap<String, Object> params);
From what I understand, a string representation of the string array is bring formed by retrofit. How can I resolve this?