title: Groovy & json: How to get the length of an array from json?
body: <p>I am using curl to get some data, then parsing it with <code>JsonSlurper</code>.
  The data structure is </p>
  
  <pre><code>"results" : [ 
     {
        "uri" : "http://localhost:8081/artifactory/api/storage/...",
        "created" : "2015-11-27"
     },
     {
        "uri" : "http://localhost:8081/artifactory/api/storage/...",
        "created" : "2015-11-27"
     }, 
     {
        "uri" : "http://localhost:8081/artifactory/api/storage/...",
        "created" : "2015-11-30"
     } 
  ]
  </code></pre>
  
  <p>So if I'm not mistaken, the entire thing is considered an object. But there is an array in the object (results) which contains objects in that array.</p>
  
  <p>I need to get the length of the results array. When I try to do json.result.length, I receive a null. </p>
  
  <p>How can I get the length of the <code>results</code> array? </p>
  
  <pre><code>def list = ['curl', '-u', 'user:pass',     "http://localhost:8081/..."].execute()
  def json = new JsonSlurper().parseText(list.text)
  println json.result.size()
  </code></pre>