Keycloak API UserRepresentation.getgroups always null

When Using the API (17.0.1) and call either :
UsersResource.search(userName, true) or
UsersResource.get(id).toRepresentation()

i get a UserRepresentation object.
Eventhough the found users are part of a group the groups (List) field is null.

When I call UsersResource.get(id).groups() i do see them.

How can i make sure that the UserRepresentation.groups field isn’t null