Thank you Rao. That makes perfect sense. This withEachIndex is exactly what I was looking for. I suspect this will help others as well. I am still throwing an error after many editing attempts. I've done some searching...not sure what is missing with a find or subsequent step. Thank you, again.
I) Current JSON Parser
package json
import com.eviware.soapui.support.XmlHolder
import groovy.json.*
//define the location of the JSON file
def response = context.expand( '${get_descendants#Response}' ).toString()
//log.info(response)
//define "json" which will be the name of my variable
def json = new JsonSlurper().parseText (response)
json.items.eachWithIndex
{
item, index ->
log.inf "totalResults: ${index}"
log.inf "Item resourceId: ${item.resourceId}"
log.info "Item name: ${item.name}"
log.info "Item resource type: ${item.resourceType}"
log.info "Item status: ${item.status}"
}
II) Error Message thrown (if I comment out totalResults line same error occurs for subsequent lines):
groovy.lang.MissingMethodException:
No signature of method: org.apache.log4j.Logger.inf() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [totalResults: 0]
Possible solutions: info(java.lang.Object), find(), any(), info(java.lang.Object, java.lang.Throwable), is(java.lang.Object), find(groovy.lang.Closure)