Java NotSerializableException when returning a org.keycloak.representations.idm.UserRepresentation

I have a rest service in java that ask to keycloak a list of users.

This is the method:

public GridResponse<UserRepresentation> getFilterdRecords(String token, String azienda, String esercizio, MultivaluedMap<String, String> formParams) throws BssException {
    GridRequest request = new GridRequest(formParams);
    // interrogo gli utenti su keycloak che hanno il ruolo o i ruoli X Y Z
    try {
        return ResourceService.getUsers(KeycloakUtility.readRealmFromJson(), request);
    } catch (Exception ex) {
        LOG.log(Level.SEVERE, "Errore interrogazione utenti su keycloak", ex);
        throw new BssException();

public static GridResponse<UserRepresentation> getUsers(Configuration conf, GridRequest request) throws Exception {

    Keycloak keycloakClient = KeycloakUtility.getKeycloak(conf);
    RealmResource realmResource = keycloakClient.realm(conf.getRealm());
    UsersResource usersResouce  = realmResource.users();
    List<UserRepresentation> results = usersResouce.list(request.getFirst(), request.getPageSize());
    Integer count = usersResouce.count();
    GridResponse<UserRepresentation> response = new GridResponse<>(results, count.longValue(), null);
    KeycloakUtility.logoutkeycloak(conf, keycloakClient);
    return response;

the method works and the users are returned.

If I call it form the web and so the json serialization is required, i get the following exception: org.keycloak.representations.idm.UserRepresentation

I’m using jackson. I need to create a Serializer or there is one in the libraries?
Or i’m doing some mistakes?