We have a JSON on which when we are running the below query it fails after next execution.
Query: list[?( @ && @.step && /STEP_/.test(@.step)&&@.event=="Passed" )]
CA Release Automation (CARA): 6.5, 6.6 or higher
The syntax as per JsonPath library, is to use ~= instead of test function to filter strings. The correct query version of above will be
$.list[?(@.step =~ /STEP_.*/ && @.event == 'Passed')].comments
I am assuming the query I shared is been referred as worked. The reason your query didn't worked because of the valid syntax JSON path required during filtering. The link I shared with you is having more detail in somewhere middle of the page. https://github.com/json-path/JsonPath The operator we used based is for the very reason i.e. (more detail in document above) =~ left matches regular expression [?(@.name =~ /foo.*?/i)]