【问题标题】:In Gatling/Scala how do I convert a jsonPath into an array?在 Gatling/Scala 中,如何将 jsonPath 转换为数组?
【发布时间】:2019-11-01 13:39:37
【问题描述】:

以下检查产生错误声明

没有为类型 Seq[String] 找到类型类 JsonFilter 的成员

...
.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"},
}

【问题讨论】:

    标签: scala gatling


    【解决方案1】:

    findAll 是我要搜索的内容。

    .check(
    jsonPath("$..foo").findAll
       .transform((a) => {println(a);a})
       .saveAs("bar")
    )
    

    来源

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-25
      • 2022-10-17
      • 2020-11-24
      • 1970-01-01
      • 2020-10-22
      • 2018-09-24
      • 2012-09-30
      • 1970-01-01
      相关资源
      最近更新 更多