title: How to assign values to array using groovy?
body: <p><em><strong>Response:</em></strong></p>
  
  <pre><code>[
      {"msisdn":"85237009372","name":"Vicky","carrier":"AIRTEL"},
      {"msisdn":"85237009373","name":"Vicky1","carrier":"AIRTEL"}
  ]
  </code></pre>
  
  <p>I want to extract the all name from response and assign it to array/list?</p>
  
  <p><em><strong>Code:</em></strong></p>
  
  <pre><code>import groovy.json.JsonSlurper
  
  // Retrieve valid mptu Amounts from GET mptu-amounts response
  context.responseContent = context.testCase.getTestStepByName("xxxx").getPropertyValue("r_responseContent")
  
  try
  {
    responseContentParsed = new JsonSlurper().parseText( context.responseContent )
  
    context.mptuValidAlias = responseContentParsed.name[0]
    log.info(context.mptuValidAlias)
  }
  </code></pre>
  
  <p>It is retrieving the first row, name (i.e) vicky only.. i wanted to extract name of all rows and assign it to list.. How to do this?</p>