我们如何计算 Karate Framework 中 JSON api 响应的记录数?
How we can count the number of records from JSON api response in Karate Framework?
我想从 Karate Framework 中的 JSON Api 响应中获取特定键的计数。
{
{"user" : "a"},
{"user" : "b"},
{"user" : "c"}
}
从上面JSON我想得到响应的用户数。
请仔细阅读文档和示例,您可以直接使用JavaScript:
* def response =
"""
[
{"user" : "a"},
{"user" : "b"},
{"user" : "c"}
]
"""
* def len = response.length
* match len == 3
我想从 Karate Framework 中的 JSON Api 响应中获取特定键的计数。
{
{"user" : "a"},
{"user" : "b"},
{"user" : "c"}
}
从上面JSON我想得到响应的用户数。
请仔细阅读文档和示例,您可以直接使用JavaScript:
* def response =
"""
[
{"user" : "a"},
{"user" : "b"},
{"user" : "c"}
]
"""
* def len = response.length
* match len == 3