I m trying to write JSON path expression using regex, it works fine when i fetch the JSON node and compare with regex, but in my case i have to compare regex with JSON node, I get the JSON node from JSON file and real path from my app, i have to check whether real path contains JSON node. RealPath=/secure/api/sso/login JSON NODE Path=/api/sso/login
My JSON looks like this
{
"path": [{
"relativepath": "/api/sso/login",
"transformation": "true"
},
{
"relativepath": "/api/sso/logout",
"transformation": "false"
}
]
}
and JSON Path which is working for me fine is $..[?(@.relativepath =~ /^./api/sso/login.$/)]
I have to check in JSON PATH whether /secure/api/sso/login contains /api/sso/login(fetched using JSON Path)