title: JMeter: How to count JSON objects in an Array using jsonpath
body: <p>In JMeter I want to check the number of objects in a JSON array, which I receive from the server. </p>
  
  <p>For example, on a certain request I expect an array with 5 objects.</p>
  
  <p>[{...},{...},{...},{...},{...}]</p>
  
  <p>After reading this: <a href="https://stackoverflow.com/questions/13745332/count-members-with-jsonpath/20498983#20498983">count members with jsonpath?</a>, I tried using the following JSON Path Assertion:</p>
  
  <ul>
  <li>JSON Path: $</li>
  <li>Expected value: hasSize(5)</li>
  <li>Validate against expected value = checked</li>
  </ul>
  
  <p>However, this doesn't seem to work properly. When I actually do receive 5 objects in the array, the response assertion says it doesn't match.</p>
  
  <p>What am I doing wrong? 
  Or how else can I do this?</p>