2017-02-16 141 views

回答

0

这里是常规脚本固定JSON

def json = """{ 
    "Request": { 
     "UserId": "user", 
     "TxnType": "fetch" 
    } 
}""" 

def transactionType = new groovy.json.JsonSlurper().parseText(json).Request.TxnType 
log.info "TxnType is : ${transactionType}" 

来获取请求值,您可以快速地尝试Demo

如果要使用动态JSON中模拟脚本,那么你可以使用下面的模拟脚本调度器

def transactionType = new groovy.json.JsonSlurper().parseText(mockRequest.requestContent).Request.TxnType 
log.info "TxnType is : ${transactionType}"