【问题标题】:Storing Json response element in a variable using Karate使用空手道将 Json 响应元素存储在变量中
【发布时间】:2017-11-27 19:17:27
【问题描述】:

将以下 json 响应存储在变量中

[{"Resort":"SANRS","ResvNameID":14396162,"ConfirmationNo":"86749976"}, {"Resort":"SANRS","ResvNameID":13123123,"ConfirmationNo":"98932423"}]

and def allres = response 并且 print allres.reservations[0].ResvNameID 不打印任何东西?这里有什么问题?

【问题讨论】:

  • 我认为我接受它作为答案

标签: rest karate


【解决方案1】:

您的 JSON 路径错误。

试试:

* print allres[0].ResvNameID

输出:

[print] 14396162

【讨论】:

    猜你喜欢
    • 2019-08-24
    • 1970-01-01
    • 2019-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-28
    相关资源
    最近更新 更多