Below is the JavaScript Object structure that I currently have:
[
[
null,
"A"
],
[
"A",
"B"
],
[
"A",
"C"
],
[
null,
"D"
],
[
"D",
"E"
],
[
"D",
"F"
],
[
"B",
"G"
]
]
I am looking to rearrange it into the following structure:
[
{
parent: "A",
child : [
{
parent : "B",
child : [
{
parent : "G"
}
]
},
{
parent : "C"
}
]
},
{
parent: "D",
child : [
{
parent : "E"
},
{
parent : "F"
}
]
}
]