我在JSON路径中采用坐标时遇到一些问题。我想在链接中使用id 8352。我想要没有蜇和逗号的id。就像这个“8352”。
这是我的JSONPath语法:$ .issue [1] .diagnostics [42,43,44,45]
这是我的JSON路径:
`
{
"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"
]`
你将无法使用JSON value提取部分JSON Extractor,更好的想法将改为Regular Expression Extractor,相关的正则表达式将是这样的:
Observation/(\d+)/
其中\d+
代表Observation
之后的斜杠之间的任意位数。
演示: