I have an Object which contains sub-objects as children. I need to convert it into array:
var myObj = {
a: 5,
b: 6,
c: {
a: {
a: {
a: 7
}
}
},
d: {
a: {
a: 8,
b: 9,
c: {
a: 10
}
},
b: 11
}
}
like this:
myArray = [
a: 5,
b: 6,
c: [
a: [
a: [
a: 7
]
]
],
d: [
a: [
a: 8,
b: 9,
c: [
a: 10
]
],
b: 11
]
];
What is the best way to achieve this?
myArray[c][a][a][a]myObj["c"]["a"]["a"]["a"]