Error in JsonPath query filtering string

Document ID : KB000124403
Last Modified Date : 11/01/2019
Show Technical Document Details
Issue:
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" )]
Environment:
CA Release Automation (CARA): 6.5, 6.6 or higher
Cause:
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
Resolution:
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)]
Additional Information:
For details reference around JsonPath please refer to https://github.com/json-path/JsonPath