I have a JSON object like the one given below where there the last child element is an array of strings. What I need is that I should pass the "ParentKey" to a function as an input and it should return me all the array items (under each key) pushed into an unified array without having to specify each parent key.
The final output should from the below given object should be like: ["Key1-Key1.1-Val1","Key1-Key1.1-Val2", "Key1-Key1.1-Val3", "Key1-Key1.1-Val4", "Key1-Key1.2-Val1",...]
"Parentkey": {
"key1": {
"key1.1": [
"Val 1",
"Val 2",
"Val 3",
"Val 4"
],
"Key1.2": [
"Val 1",
"Val 2",
"Val 3",
"Val 4"
],
"Key1.3": [
"Val 1",
"Val 2",
"Val 3",
"Val 4"
]
},
"key2": {
"key2.1": [
"Val 1",
"Val 2",
"Val 3",
"Val 4"
]...
}
}
The function needs to be such that I must not require to give the names of the child keys but only the "ParentKey" as an object.
Based on this out put, I need to create an angular based directive to show hide elements based on user's access rights.
Thanks.