使用空手道框架从嵌套的JSON获取值
我有以下JSON值。
{
"TestA": [
{
"Condition1": "Value1,
"Condition2": "Value2",
"Condition3": "Value3"
}
],
"TestB": [
{
"Condition11": "Value11,
"Condition12": "Value12",
"Condition13": "Value13"
}
],
"TestC": [
{
"Condition21": "Value21,
"Condition22": "Value22",
"Condition23": "Value23"
}
]
}
我想获得条件的价值11。 (值11)。
我尝试了TestB包含“ value11”的作用。
目前,当我使用下面的两个选项时,它们将我返回完整的嵌套JSON如上所述,而不是预期的。
我尝试了testb.condition11 ==“ value11”,它不起作用。 我尝试了testb.condition11 [0] ==“ value11”它不起作用。
有人可以通过使用==选项而不包含来帮助获取值。
谢谢。
I have a following json values.
{
"TestA": [
{
"Condition1": "Value1,
"Condition2": "Value2",
"Condition3": "Value3"
}
],
"TestB": [
{
"Condition11": "Value11,
"Condition12": "Value12",
"Condition13": "Value13"
}
],
"TestC": [
{
"Condition21": "Value21,
"Condition22": "Value22",
"Condition23": "Value23"
}
]
}
I want to get the value of Condition11. (which is value 11).
I tried TestB contains "Value11" it works.
Currently when i use the two options below, they return me the complete nested Json as above and its not what is expected.
i tried TestB.Condition11 == "Value11" , it does not work.
I tried TestB.Condition11[0] == "Value11" it does not work.
Can someone please help in getting the value by using the == option and not contains.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该阅读文档。以下只是一种方法,有很多方法可以做到这一点:
请参阅 https:// github。 COM/KARATELABS/BARATE#JSONPATH-FILTERS
You should read the documentation. Here below is just one way, there are many ways to do this:
Refer https://github.com/karatelabs/karate#jsonpath-filters