JMeter:如何获取JSON路径中的坐标
我在获取JSON路径中的坐标时遇到了一些问题。 我想在链接中使用id 8352。我想要没有戳和逗号的id。就像这个“8352” 这是我的JSONPath语法:$.issue[1]。诊断[42,43,44,45] 这是我的JSON路径: `JMeter:如何获取JSON路径中的坐标,json,jmeter,evaluation,Json,Jmeter,Evaluation,我在获取JSON路径中的坐标时遇到了一些问题。 我想在链接中使用id 8352。我想要没有戳和逗号的id。就像这个“8352” 这是我的JSONPath语法:$.issue[1]。诊断[42,43,44,45] 这是我的JSON路径: ` { “问题”:[ { “严重性”:“信息”, “诊断”:“验证期间未检测到任何问题”, “代码”:“信息性” }, { “严重性”:“信息”, “诊断”:“已成功创建资源观测/8352/_历史记录/1”, “代码”:“信息性” } ], “文本”:{ “div
{
“问题”:[
{
“严重性”:“信息”,
“诊断”:“验证期间未检测到任何问题”,
“代码”:“信息性”
},
{
“严重性”:“信息”,
“诊断”:“已成功创建资源观测/8352/_历史记录/1”,
“代码”:“信息性”
}
],
“文本”:{
“div:“Operation Outcome Information[]在9毫秒内成功创建了资源“Observation/8352/\u history/1”\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[]\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\,
“状态”:“已生成”
},
“资源类型”:“操作输出”
}`
这是我的JSON评估结果:
`[
"8",
"3",
"5",
"2"
]`
您将无法使用提取一个分部,最好使用一个更好的方法,相关的正则表达式如下所示:
其中,\d+
表示观察后斜杠之间的任意位数
演示:
更多信息:请将这些文本作为纯文本共享。我已更改了它。
{
"issue": [
{
"severity": "information",
"diagnostics": "No issues detected during validation",
"code": "informational"
},
{
"severity": "information",
"diagnostics": "Successfully created resource Observation/8352/_history/1",
"code": "informational"
}
],
"text": {
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">information</td><td>[]</td><td><pre>Successfully created resource "Observation/8352/_history/1" in 9ms</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">information</td>\n\t\t\t\t<td>[]</td>\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t<td><pre>No issues detected during validation</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>",
"status": "generated"
},
"resourceType": "OperationOutcome"
}`
This is my JSON evaluation result:
`[
"8",
"3",
"5",
"2"
]`
Observation/(\d+)/