如何在空手道中将 Json 对象转换为 Json 数组?
How can I convert to Json Object to Json Array in Karate?
我想在空手道中将 Json Object 转换为 Json Array 以使用 'match each' 函数。
我遇到 ('match each' failed, not a json array) 错误,当我使用 match each func with Json Object.
这是我的 Json 对象:
{
{ "a": "q"
"b": "w",
"c": "t"
},
{ "a": "x"
"b": "y",
"c": "z"
}
}
这是我需要的:
[
{
{ "a": "q"
"b": "w",
"c": "t"
},
{ "a": "x"
"b": "y",
"c": "z"
}
}
]
试试这个方法,使用嵌入的表达式:https://github.com/intuit/karate#embedded-expressions
* def foo = { a: 1 }
* def list = [ '#(foo)' ]
* match each list == foo
我想在空手道中将 Json Object 转换为 Json Array 以使用 'match each' 函数。 我遇到 ('match each' failed, not a json array) 错误,当我使用 match each func with Json Object.
这是我的 Json 对象:
{
{ "a": "q"
"b": "w",
"c": "t"
},
{ "a": "x"
"b": "y",
"c": "z"
}
}
这是我需要的:
[
{
{ "a": "q"
"b": "w",
"c": "t"
},
{ "a": "x"
"b": "y",
"c": "z"
}
}
]
试试这个方法,使用嵌入的表达式:https://github.com/intuit/karate#embedded-expressions
* def foo = { a: 1 }
* def list = [ '#(foo)' ]
* match each list == foo