Rest-assured. How to check if not empty array is returned?

I came up with the following solution:

given().baseUri("http://...").get("/categories/all")
    .then()
    .body(
        "results", hasSize(greaterThan(0))
    );

It fails if "results" is an empty array or not an array. It passes if "results" is a not-empty array. It reports an error in a readable way, e.g.:

Expected: a collection with size a value greater than <0>
Actual: null

I hat a similar problem but in my case the endpoint direcly returns an array. My solution for this:

@Test
public void testNotEmpty() {
    uAssured.given()
            .when()
                .get("resources/totest")
            .then()
                .statusCode(200)
                .body("$.size()", greaterThan(0));
}

For the example above the following should work as well:

@Test
public void testNotEmpty() {
    uAssured.given()
            .when()
                .get("resources/totest")
            .then()
                .statusCode(200)
                .body("results.size()", greaterThan(0));
}