使用 Apache JMeter ver 3.2 r1790745(最新)测试 JSON Web 服务,响应如下:
[ {
"id" : 3,
"description" : "Back",
"name" : "back"
}, {
"id" : 1,
"description" : "Front",
"name" : "front"
}, {
"id" : 6,
"description" : "Left",
"name" : "left"
}]
想要解析上述响应以获取 JSON Extractor 中一个字符串中的所有 id,例如
3,1,6
我的 JSON 路径表达式是这样的:
$..id
但我只得到了第一个 id,即 3,与$.[0].id
检查 BeanShell PostProcessor 中的结果相同。如果我去http://jsonpath.com/
$..id 确实给了我
[
3,
1,
6
]