title: Using REST Assured, how can I check if a field is present or not in an array of json objects type of response?
body: <p>I need to validate that a response like the one below contains some fields. I am not interested in the fields value - just that the keys exist.
  For example I want to check that the key "id" is present in this type of response. How would I accomplish that?</p>
  
  <pre><code>[  
     {  
        "id":"1",
        "title":"Title",
        "details":"details",
        "benefit":"Welcome",
        "expirationTimestamp":1549995900,
        "notice":"some text",     
     }
  ]
  </code></pre>
  
  <p>If I do </p>
  
  <pre><code>given()
    .spec(reqSpec).
  when()
    .get().
  then()
    .body("$", hasKey("id"));
  </code></pre>
  
  <p>I get an error like this:</p>
  
  <pre><code>java.lang.AssertionError: 1 expectation failed.
  JSON path $ doesn't match.
  Expected: map containing ["id"-&gt;ANYTHING]
    Actual: [{blabla=something, id=1, details=details, etc=etc}]
  </code></pre>
  
  <p>Please, can someone explain to me how this should work?</p>