I have this test data:
[
{
id: 1,
l: 'a',
sub: [
]
},
{
id: 2,
l: 'b',
sub: [
{
id: 4,
l: 'd'
},
{
id: 5,
l: 'e'
},
{
id: 6,
l: 'f',
sub: [
{
id: 7,
l: 'g'
}
]
}
]
},
{
id: 3,
l: 'c',
sub: []
}
];
And I'm trying to get the path of the object with id: 7
. I tried quite some JSONPath queries, but I just can't seem to fiind out how to make JSONPath iterate over all sub
keys and search in there.
How can I match the object with id: 7
?
Here is my testing plunkr: http://plnkr.co/edit/RoSeRo0L1B2oH3wC5LdU?p=preview