2017-02-16 137 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}"