I'm creating a Web Service, but I'm wondering how to get JSON in it as a parameter.
@Path("WebService/{json}")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String POST (@PathParam("json") String json)
{
return json ;
}
In this code I'm getting JSON in the URL like this:
http://localhost:8080/IC/webresources/WebService/[ { "name": "SAM", "id": 1 }, { "name": "DEAN", "id": 2 } ]
That is, there is a JSON in the URL.
That's the only way I've found it so far. Can someone give me a light?