How-to articles, tricks, and solutions about JAX-RS

Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

This error is usually encountered when trying to parse a JSON string that does not start with a JSON array, but rather a JSON object.

JAX-RS — How to return JSON and HTTP status code together?

In JAX-RS, you can use the Response class from the javax.ws.rs.core package to return a JSON response and an HTTP status code together. Here's an example of how to do this:

When to use @QueryParam vs @PathParam

In a Java RESTful web service, the @QueryParam annotation is used to bind a query parameter to a method parameter, while the @PathParam annotation is used to bind a path parameter to a method parameter.