Forum Discussion

donaldngo's avatar
donaldngo
Occasional Contributor
14 years ago

How do i get JSON values from a response in Groovy

Hi I figured out how to grab NodeValue from XML responses in Groovy using: def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder ("create a ...
  • nmrao's avatar
    nmrao
    9 years ago

    Here is the later part of the script:

     

    It was not working because, items is a Json Array.

     

    json.items.eachWithIndex{ item, index ->
      log.info "Item #: ${index}"
      log.info "Item resource Id: ${tem.resourceId}"
      log.info "Item name : ${item.name}"
      log.info "Item resource type : ${item.resourceType}"
      log.info "Item status : ${item.status}"
    }