尝试从空手道中的 API 响应中获取值时出错
Getting error when try to fetch value from API response in Karate
我正在尝试从我的 API 响应中获取一个值。但它抛出错误:
我的 API 回复:
{
"metadata": {
"count": 68,
"query_time": "241.674ms"
},
"aggResultValue": [
{
"product": "ABC",
"min(price)": 64
},
{
"product": "DEF",
"min(price)": 30
}
]
}
当我使用时,
$.aggResultValue[*].min(price)
它returns一个错误:
pricemax.feature:42 - Aggregation function attempted to calculate value using empty array
我有点困惑为什么会收到此错误,因为我只是想获取值,而不是计算任何东西。
任何其他验证方法也会对我有所帮助。
改为这样做:
$.aggResultValue[*]['min(price)']
我正在尝试从我的 API 响应中获取一个值。但它抛出错误:
我的 API 回复:
{
"metadata": {
"count": 68,
"query_time": "241.674ms"
},
"aggResultValue": [
{
"product": "ABC",
"min(price)": 64
},
{
"product": "DEF",
"min(price)": 30
}
]
}
当我使用时,
$.aggResultValue[*].min(price)
它returns一个错误:
pricemax.feature:42 - Aggregation function attempted to calculate value using empty array
我有点困惑为什么会收到此错误,因为我只是想获取值,而不是计算任何东西。
任何其他验证方法也会对我有所帮助。
改为这样做:
$.aggResultValue[*]['min(price)']