Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Karate 如何使用[*]JSONPath通配符来检索数组值_Karate_Jsonpath - Fatal编程技术网

Karate 如何使用[*]JSONPath通配符来检索数组值

Karate 如何使用[*]JSONPath通配符来检索数组值,karate,jsonpath,Karate,Jsonpath,我试图从响应中检索animalId值。数组是动态的,因此我尝试使用def animalIds=response.animals[*].animalId从数组中检索animalId值 答复: { "animals": [ { "animalId": "1234565", "animalName": "Tom" }, { "animalId": "1234567",

我试图从响应中检索
animalId
值。数组是动态的,因此我尝试使用
def animalIds=response.animals[*].animalId
从数组中检索
animalId

答复:

{
    "animals": [
        {
            "animalId": "1234565",
            "animalName": "Tom"
        },
        {
            "animalId": "1234567",
            "animalName": "Dave"
        }
    ]
}
但是,当我执行功能文件时,我收到以下错误:

response.animals[*].animalsId
                  ^ in <eval> at line number 1 at column number 18

com.intuit.karate.exception.KarateException: there are test failures !
        at ...(.)
The terminal process terminated with exit code: 1
response.animals[*].animalsId
^在第1行第18列中
com.intuit.karate.exception.karateeexception:有测试失败!
在…()
终端进程终止,退出代码为:1
关于如何解决这个问题,有什么想法吗?

应该是:

* def animalIds = $response.animals[*].animalId
阅读文档:

应该是:

* def animalIds = $response.animals[*].animalId
阅读文档: