title: Hamcrest matchers
body: <p>I have written a hamcrest like this in RestAssured response specification</p>
  
  <pre><code>builder.expectBody("hotelavailabilities.rateplans.rooms.adults", 
      anyOf(
         hasItemInArray(
            anyOf(
               hasItemInArray(
                   anyOf(hasItemInArray(Integer.parseInt(adults))))))));
  </code></pre>
  
  <p>I want to build an assertion like above so I compare the json output with this assertion</p>
  
  <p>But i get an error like below</p>
  
  <pre><code>java.lang.AssertionError: 1 expectation failed.
  JSON path hotelAvailabilities.ratePlans.rooms.adults doesn't match.
  Expected: (an array containing (an array containing (an array containing &lt;2&gt;)))
    Actual: [[[2], [2]], [[2]], [[2], [2]], [[2], [2]]]
  </code></pre>
  
  <p>How to write the hamcrest so that the output is covered and asserted?</p>
  
  <p>JSON schema:</p>
  
  <p><a href="https://i.stack.imgur.com/Nkc7z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nkc7z.png" alt="enter image description here"></a></p>
  
  <p>Also sometimes there might be only one array in rooms object or there might be three but 2 will be constant</p>