首页 > Web开发 > 详细

[JSON] Validating/Asserting JSON response with Jsonlurper

时间:2015-06-18 12:59:27      阅读:213      评论:0      收藏:0      [点我收藏+]
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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!