I have a java ee application that uses jax-rs. But when i return a boolean in a call that returns json, it gives a 500 error.
@GET
@Path("/test")
@Produces("application/json")
public boolean test() {
return true;
}
The above code will give this generic error message: The server encountered an internal error that prevented it from fulfilling this request.
If i remove the @Produces("application/json")
it does work but returns 'text/plain'.
JSON consists of key:value
pairs. So you cannot return a simple boolean, because what should be the name of the corresponding key ?
So either return a Map<String, Boolean>
or a boolean[]