I have a simple JSON(below). The content in the modified array element may vary. I need to have a fixed output whenever the modified element has at least one file name that starts with 'test/' and a different output if none of the file starts with 'test/'. I need to do that using JsonPath.
So far all the expressions I have used (e.g. $.commits[].[?(@ =~ /test.*?/i)]) gives me the list of files if the expression is matched, I need to have a fixed value (true or false) not the modified[] element value, if any of the array element in the modified element starts with 'test'.
Any help will be much appreciated.
{"commits":[{"modified":["test/db/ecs-db.sql","test/infra/infra-settings.json","test1/code/code.java"]}]}