JSONPath does not return values when using in Karate but does using online evaluator

前端 未结 1 997
心在旅途
心在旅途 2021-01-26 21:51

I\'m fairly new to JSONPath so this could be my fault but when I try this expression in an online evaluator (https://jsonpath.com/) it works but does not in Karate.



        
相关标签:
1条回答
  • 2021-01-26 22:45

    The JsonPath engine is known to have issues with such complex expressions. Please use karate.filter() instead which I am sure you will agree is much more readable: https://github.com/intuit/karate#json-transforms

    * def resources = $..resource
    * def fun = function(x){ return x.resourceType == 'AllergyIntolerance' && x.category[0] == 'food' }
    * def temp = karate.filter(resources, fun)
    
    0 讨论(0)
提交回复
热议问题