需要使用 Jsonpath 提取器为 JMeter 中的嵌套请求提取 json 值
Need to extract a josn value for nested requests in JMeter using Jsonpath extractor
我有一个动作产生的响应。我需要在 JMeter
中使用 json 路径提取器提取 userid 节点的值
{
"ABC": "{"response":{"userId":user1,"caseId":0,"name":"Json","email":"json@xyz.com","mobileNumber":"1223456789","countryCodeId":"1","countryCode":"+90","emailOTP":830782,"mobileOTP":301879,"mobileOTPString":null,"otpCreationDate": “2021-10-14T10:01:38.5802765Z”,“configOTPTimeOut”:120,“redirectUrl”:null,“isOTPExpired”:false,“countryCodeValidMessage”:null,“mobileNumberValidMessage”:null,“offset”:“00: 00:00","postStatus":false,"postMessage":null,"id":null,"response":null,"isProceedToCreateMeeting":false},"successcode":0,"message":null}"
}
我试过$..ABC.response.userId,它说NoMatch。提取 response
中存在的 userId 节点的正确语法是什么
您向我们展示的内容无效 JSON(您可以使用 https://jsonlint.com/ website or equivalent) therefore you won't be able use either JSON Extractor or JSON JMESPath Extractor
自行检查
除非是复制粘贴问题,否则您只能使用 Regular Expression Extractor,正则表达式示例如下:
"userId"\s*:\s*(.+?)\s*,
我有一个动作产生的响应。我需要在 JMeter
中使用 json 路径提取器提取 userid 节点的值{ "ABC": "{"response":{"userId":user1,"caseId":0,"name":"Json","email":"json@xyz.com","mobileNumber":"1223456789","countryCodeId":"1","countryCode":"+90","emailOTP":830782,"mobileOTP":301879,"mobileOTPString":null,"otpCreationDate": “2021-10-14T10:01:38.5802765Z”,“configOTPTimeOut”:120,“redirectUrl”:null,“isOTPExpired”:false,“countryCodeValidMessage”:null,“mobileNumberValidMessage”:null,“offset”:“00: 00:00","postStatus":false,"postMessage":null,"id":null,"response":null,"isProceedToCreateMeeting":false},"successcode":0,"message":null}" }
我试过$..ABC.response.userId,它说NoMatch。提取 response
中存在的 userId 节点的正确语法是什么您向我们展示的内容无效 JSON(您可以使用 https://jsonlint.com/ website or equivalent) therefore you won't be able use either JSON Extractor or JSON JMESPath Extractor
自行检查除非是复制粘贴问题,否则您只能使用 Regular Expression Extractor,正则表达式示例如下:
"userId"\s*:\s*(.+?)\s*,