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 to an object using id: 7. I tried some JSONPath requests, but I just can't figure out how to make JSONPath iterate over all keys suband search there.
How can I map an object to id: 7?
Here is my test plunkr: http://plnkr.co/edit/RoSeRo0L1B2oH3wC5LdU?p=preview
source
share