I am new with JSONPath and any help is appreciated. I am trying to filter data based on its sibling value.
My JSON sample:
[
{
"id": "10300",
"name": "NAME1"
},
{
"id": "10500",
"name": "NAME2"
}
]
And I would like to query id by the name. I tried something like this, but without luck:
$..id[?(@name=='NAME1')]
I am sure I missed something trivial.
I found the solution by myself after all.
$..[?(@.name == 'NAME1')].id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With