I have an array of objects in which I want to get the value of a key for e.g. 'variable'. But the depth of the key is varying, like it could be as follows -
[{
"test": {
"nameObj": {
"name": "DateExpires",
"title": "DateExpires",
"variable": "DateTime"
},
}
},
{
"test": {
"nameObjSomethingElse": {
"name": "DateExpires",
"title": "DateExpires",
"variable": "DateTime"
},
}
},
{
"test": {
"nameObjSomethingElse": {
"name": "DateExpires",
"title": "DateExpires",
"anotherLevel": {
"variable": "DateTime"
}
}
}
}]
In each object in the array key 'variable' is at different level and under different key. How can I get the value of 'variable'?
variable, when fetching it do you want to get them all or the first occurrence for example ?