【发布时间】:2017-05-10 12:36:12
【问题描述】:
使用Apache JMeter ver 3.2 r1790745(最新)测试一个JSON Web Service,响应如下:
[ {
"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
]
【问题讨论】:
-
我收到了
myvar=[3,1,6],正如你所提到的。我没有看到您的语法有任何错误。