Here's what my JSON looks like
{
"groups": [{
"label": "Data Plane",
"groups": [{
"label": "Compliance Data %",
"groups": [{
"label": "Data1"
}, {
"label": "Data2"
}, {
"label": "Data3"
}, {
"label": "Data4"
}]
}]
}]
}
I have parsed this JSON in my JS, and, I have managed to push the Data Plane into a new array. I would also like to push the labels Compliance Data % and the labels Data1, Data2, and Data3 into the same array in the same tree format as that of the JSON.
I tried the groups[0].groups[0].groups[0].push function to push to the inner most label. But that doesn't work. I have already extracted the JSON object label and fed it to another array, and I'm trying to push these values. I would like to know how to push it to a new array IN the same structure.