I'm using the Gson Library and JAX-rs for a RestFull-API project. This is my endpoint:
@POST
@PermitAll
@Path("/search")
public List<Model> listAll(@BeanParam @Valid PageRequest page, SearchModelRequest request) {
List<Model> models = modelDao.getOrderedByViews(page);
return models;
}
The system automatically serialise the model object with a full JSON with all attributes, but I just want to send some of them; how Can I do?