I need some help with REST APIs. I'm trying to send JSON data through an API by using Postman's Body to test it. It appears to work, but when I check the Array by Debugging the code it says that the Array's size is 0.
I'm trying to send this:
{
"data":[
{
"name":"",
"valor":"",
"check":"0",
"ind":"1"
},
{
"name":"",
"valor":"* FT NPR **",
"check":"1",
"ind":"0"
}
]
}
I'm using Java EE. I've tried to parsing the code to String but I don't know if I'm doing it wrong or if it just doesn't work.
This is the code:
@GET
@Path("subGroup")
@Produces("application/json")
@Consumes(MediaType.APPLICATION_JSON)
public Response definedSubGrupo(@QueryParam("Us") int US, JSONArray data)
{
String Data=UtilClass.definedSubGrupo(data);
return UtilClass.getReturn(Data);
}
I expected the full JSON that I sent, but the actual output is nothing (size=0).
Thank you.