0

I am writing a rest service which takes a list of complex Java objects (passed as a JSON object) as a parameter , and returns a java object (in JSON fomat). For instance, the get method takes in a list of A objects and returns B object. How can I do this with @GET method? Or is there a better way for doing this?

@Path("get/")
@GET
@Consumes("application/json")
@Produces("application/json")
public B getData(List<A> listOfObjects);
Amruta
  • 13
  • 5

1 Answers1

0
@Path("get/{query}")
@GET
@Produces("application/json")
public B getData(@QueryParam("query") String query);

and manually parse your list in method body with your favorite json parser

or as described in this answer - you can make some custom wrapper

Community
  • 1
  • 1
Puh
  • 305
  • 1
  • 10