我正在尝试提取response[0].otpValue
,但是它不起作用
我试图:
get[0] response.id
response[0].otpValue
{
"errorCode": null,
"response": [
{
"createdTimestamp": 1557314537720,
"lastUpdatedTimestamp": 1557314537720,
"createdBy": null,
"lastUpdatedBy": null,
"otpValue": "5346",
"expiryTimestamp": 1556807308797,
"validNow": false,
"sessionUserId": null
}
],
"status": "SUCCESS",
"errorMessage": null
}
我希望从json响应中获取otpValue
* def firstOtp = response[0].id
答案 0 :(得分:1)
* def answer = { "errorCode": null, "response": [ { "createdTimestamp": 1557314537720, "lastUpdatedTimestamp": 1557314537720, "createdBy": null, "lastUpdatedBy": null, "otpValue": "5346", "expiryTimestamp": 1556807308797, "validNow": false, "sessionUserId": null } ], "status": "SUCCESS", "errorMessage": null }
* def firstOtp = answer.response[0].otpValue
* match firstOtp == "5346"