I have an unstructured JSON array file that is structured in a unique way.
[
{ "customer": "A",
"children": [
{ "id": "1", "name": "B"},
{ "customer": "B",
"children": [ ]
},
{ "customer": "C",
"children": [
{ "id": "4",
"name": "E"
}
]
},
{ "customer": "E",
"children": [
{ "id": "5",
"name": "F"
}
]
},
{ "customer": "D",
"children": [ ]
}
]
My goal is to transform this data into a tree graph visualization format using JavaScript. How can I achieve this?
[
{ "customer": "A",
"children": [
{ "customer": "B"
},
{ "customer": "C",
"children": [
{ "customer": "E",
"children": [
{ "customer": "F"
}
]
}
]
I need my output to be formatted as above for visualization on a tree graph using JavaScript.