title: Count child nodes of a JSON response using groovy in soapui
body: <p>I have a JSON response due to security reasons I had to take a screenshot and post it here.</p>
  
  <p><a href="https://i.stack.imgur.com/Rx6x2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rx6x2.png" alt="enter image description here"></a></p>
  
  <p>I need to find number of available itineraryPrice available. Each curly braces refers to a separate itinerary, how to I count those tags in a groovy script step.</p>
  
  <p><strong>Method I have tried</strong></p>
  
  <pre><code>def holder = groovyUtils.getXmlHolder( "air-search#ResponseAsXml" )
  def xpath = "//*:search/*:itineraryPrice"
  def numberOfRecommendations = holder["count(//*:search/*:itineraryPrice)"]
  log.info "Total no of recommendations : "+numberOfRecommendations
  </code></pre>
  
  <p>But I got the output as 1 :(</p>
  
  <p>Kindly help ! Please refer screenshot as well.</p>