I'm having this json:
{
"paths": {
"foo": {
"key": 1
},
"bar": {
"key": 2
}
}
}
I would like to use JSONPath
to find element "foo" by its name ("foo")
I tried something like $.paths.*.[?(~=='foo')]
but it does not seem to work (I checked on https://jsonpath.com)
If you need the to find the element by its name, this expression
$.paths.foo
outputs
[
{
"key": 1
}
]