title: Iterate and validate values in a Json Array in RestAssured Response
body: <p>I have a Rest Assured response that contains the following body:</p>
  
  <pre><code>{
     "content":[
        {
           "id":"7db80896",
           "secondaryId":"12F9BD",
           "version":1,
           "details":{
              "status":"VALID",
              "reason":"Passed validations"
           },
           "subscriptionStatuses":[
              {
                 "subscriptionId":"b8003508",
                 "subscriptionName":"Sub_1",
                 "creator":"Person 1",
                 "details":{
                    "status":"ACCEPTED",
                    "reason":"Passed validations"
                 }
              },
              {
                 "subscriptionId":"b8003509",
                 "subscriptionName":"Sub_2",
                 "creator":"Person 1",
                 "details":{
                    "status":"ACCEPTED",
                    "reason":"Passed validations"
                 }
              }
           ]
        },
        {
           "id":"7db80895",
           "secondaryId":"11F9BD",
           "version":1,
           "details":{
              "status":"VALID",
              "reason":"Passed validations"
           },
           "subscriptionStatuses":[
              {
                 "subscriptionId":"b8003509",
                 "subscriptionName":"Sub_2",
                 "creator":"Person 2",
                 "details":{
                    "status":"ACCEPTED",
                    "reason":"Passed validations"
                 }
              }
           ]
        }
     ]
  }
  </code></pre>
  
  <p>I want to verify the status "ACCEPTED" and reason "PASSED VALIDATIONS" which is nested within 2 arrays. 
  I have tried storing the reasons as a list, outlined in this <a href="https://stackoverflow.com/questions/56913639/restassured-parsing-json-array-response-using-foreach-loop">example</a> but I get the following error:</p>
  
  <p>code:
  <code>var list: List&lt;Any&gt; = response.jsonPath().getList("reason")</code></p>
  
  <p>error:
  <code>java.lang.IllegalStateException: response.jsonPath().getList("reason") must not be null</code></p>
  
  <p>Is there a way to do:</p>
  
  <pre><code>for obj in response:
     for obj2 in obj.subscriptionStatuses:
        assertThat(obj2.status == expected)
        assertThat(obj2.reason == expected)
  </code></pre>