标签:
import groovy.json.JsonSlurper def response = messageExchange.response.responseContent log.info "response : "+ response def slurper = new JsonSlurper() def json = slurper.parseText response log.info "json : "+ json log.info "json size : "+json.size() assert json.SecId.size() == 6 log.info "The first json : "+json[0] log.info "The first SecId : "+json[0].SecId assert json[0].SecId =="0P0000187J"
JsonSlurper (groovy 2.4.3 API) : http://docs.groovy-lang.org/latest/html/gapi/groovy/json/JsonSlurper.html
[JSON] Validating/Asserting JSON response with Jsonlurper
标签:
原文地址:http://www.cnblogs.com/MasterMonkInTemple/p/4585351.html