What is the JSON path Syntax needed to match different properties in different locations within a list of objects.
[
{
"myObject": "obj1",
"feilds": {
"id": "123"
},
"other": {
"otherId": "321"
}
},
{
"myObject": "obj2",
"feilds": {
"id": "234"
},
"other": {
"otherId": "432"
}
},
{
"myObject": "obj3",
"feilds": {
"id": "345"
},
"other": {
"otherId": "543"
}
}
]
I need to get following output by matching id and otherId both, of two objects and get the following outcome. I would prefer to give the absolute path for the two ID's like feilds.id and other.otherId if possible.
[
{
"myObject": "obj1",
"feilds": {
"id": "123"
},
"other": {
"otherId": "321"
}
},
{
"myObject": "obj3",
"feilds": {
"id": "345"
},
"other": {
"otherId": "543"
}
}
]
Tried something like this, but didn't really give the result I'm expecting.
$.[?((@.id=="123" && @.otherId=="321") || (@.id=="345" && @.otherId=="543"))]