I have following JSON:
{
"person": {
"id": "5678"
},
"result": {
"accounts": [
{
"id": "1234",
"details": [
{
"name": "abcd"
}
]
},
{
"id": "5678",
"details": [
{
"name": "efgh"
}
]
}
]
}
}
I need to find account based on the "id" in the "person" attribute. I tried following: $..accounts[[email protected] == $.person.id]] and it returns nothing. Any help will be greatly appreciated
I tried: $..accounts[[email protected] == $.person.id]]
I was expecting following result:
{
"id": "5678",
"details": [
{
"id": "5678",
"name": "efgh"
}
]
}
You have an extra
]
on the end of your path. When I runon my playground, https://json-everything.net/json-path, it works as expected and returns: