How to extract parameter from Json Response using Groovy?

Below is my answer.

{"activation":{"existing":false, "customer": new}} 

Now when i use

 testRunner.testCase.getTestStepByName("xxx").getPropertyValue("response") 

The above script retrieves the response. Now I wanted to extract the value "customer" .

How to do it?

thanks

+8
soapui
source share
1 answer
 import groovy.json.JsonSlurper responseContent = testRunner.testCase.getTestStepByName("xxx").getPropertyValue("response") slurperresponse = new JsonSlurper().parseText(responseContent) log.info (slurperresponse.activation.customer) 
+16
source share

All Articles