retrofit icon indicating copy to clipboard operation
retrofit copied to clipboard

Multipart iterable failure with map list parameter

Open ferostabio opened this issue 4 years ago • 0 comments

I am attempting to make a multipart iterable call. If I'm understanding correctly, this is the way to go

@Multipart
@POST("/foo/bar/")
Call<ResponseBody> method(@Part("ping") List<String> ping)

Thing is, I need to send a map list.

Call<?> sendStuff(@Part("objects") List<Map<String, String>> objects);

Where object is something like the following

{
  “objects”: [
  {
    “first: “a”,
    “last”: “b”
  },
  {
    “first: “a”,
    “last”: “b”
  },
  …
  ]
}

But no matter how many objects I send, only the last one arrives and directly as a dictionary, not as the first item in an array. This is what the server receives in a call where I sent two objects

{"objects"=>"{\"first\":\"a\",\"last\":\"b\"}"}

Tried a number of variations, with no luck. Tried asking in SO, but no answers.

ferostabio avatar Sep 30 '20 18:09 ferostabio