在 Gatling/Scala 中,如何将 jsonPath 转换为数组?
In Gatling/Scala how do I convert a jsonPath into an array?
以下检查产生错误声明
No member of type class JsonFilter found for type Seq[String]
...
.check(
jsonPath("$..foo").ofType[Seq[String]]
.transform((a) => {println(a);a})
.saveAs("bar")
)
鉴于以下 json,我希望输出看起来像:List(f1, f2, f3)
{
"one": {"foo": "f1"},
"two": {"foo": "f2"},
"three": {"foo": "f3"},
}
findAll
是我要搜索的内容。
.check(
jsonPath("$..foo").findAll
.transform((a) => {println(a);a})
.saveAs("bar")
)
来源
- https://gatling.io/docs/2.3/http/http_check/?highlight=jsonpath#multiple-results
- Gatling - Looping through JSON array
以下检查产生错误声明
No member of type class JsonFilter found for type Seq[String]
...
.check(
jsonPath("$..foo").ofType[Seq[String]]
.transform((a) => {println(a);a})
.saveAs("bar")
)
鉴于以下 json,我希望输出看起来像:List(f1, f2, f3)
{
"one": {"foo": "f1"},
"two": {"foo": "f2"},
"three": {"foo": "f3"},
}
findAll
是我要搜索的内容。
.check(
jsonPath("$..foo").findAll
.transform((a) => {println(a);a})
.saveAs("bar")
)
来源
- https://gatling.io/docs/2.3/http/http_check/?highlight=jsonpath#multiple-results
- Gatling - Looping through JSON array