REST API Map with list in response

Viewed 467

here is my issue:

I have application with REST endpoint. This endpoint returns a list of objects ActiveAdvertisement. With this everything works fine:

enter image description here

I need to reorganize this response and I grouped my data by one of object fields. So now my response should return Map<String, List<ActiveAdvertisement>>.

Now my response looks like this:

enter image description here

Why values list inside this map are not returned as Object but this looks like Object.toString() is used there?

Map is created properly, here is screenshot from debugger:

enter image description here

Here is my code from Controller:

@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getAdvertisements() {
  return Response.ok(advertisementAssembler.getAdvertisements())
      .header("Access-Control-Allow-Origin", "*")
      .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
      .allow("OPTIONS").build();
}
0 Answers
Related