[英]How to extract the Json values in jmeter using regular expression extractor?
{
"response":{
"statusCode":"00",
"status":"success",
"responseData":{
"status":1,
"themeID":27,
"themeName":"ThemeName25",
"templateId":22
}
}
}
Here i need to retrieve the value of templateId
, themeName
using regular expression extractor only not by jmeter plugins like json path extractor. 在这里,我只需要使用正则表达式提取器来检索
templateId
, themeName
的值,而不是通过JSON路径提取器之类的jmeter插件来检索。 Can anyone having for this solution?? 任何人都可以使用此解决方案吗?
Use the regexen 使用regexen
/"themeName":"([^"]+)"/
/"templateId":([0-9]+)/
to capture the result. 捕获结果。
This goes by the usual caveat that it is strongly discouraged to use regex patterns as parser substitutes 通常的警告是, 强烈建议不要使用正则表达式模式作为解析器替代
One assumption is that values for templateId
are structly numeric. 一种假设是
templateId
值在结构上是数字。
To Capture templateId: templateId":(\\d+)
捕获templateId:
templateId":(\\d+)
To Capture themeName: themeName":"(.+?)"
捕获themeName:
themeName":"(.+?)"
The special characters above are: 上面的特殊字符是:
( and ) - these enclose the portion of the match string to be returned (和)-这些将匹配字符串中要返回的部分括起来
. 。 - match any character
-匹配任何字符
+ - one or more times +-一次或多次
? ? - stop when first match succeeds
-第一场比赛成功后停止
\\d - for any digit \\ d-任何数字
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.