如何使用Groovy从Json Response中提取参数?

Cha*_*Gan 8 soapui

以下是我的回复..

{"activation":{"existing":false, "customer": new}}
Run Code Online (Sandbox Code Playgroud)

现在我用的时候

testRunner.testCase.getTestStepByName("xxx").getPropertyValue("response")
Run Code Online (Sandbox Code Playgroud)

上面的脚本正在提取响应.现在我想提取"customer"价值.

这该怎么做?

谢谢

Cha*_*Gan 18

import groovy.json.JsonSlurper

responseContent = testRunner.testCase.getTestStepByName("xxx").getPropertyValue("response")
slurperresponse = new JsonSlurper().parseText(responseContent)
log.info (slurperresponse.activation.customer)
Run Code Online (Sandbox Code Playgroud)