I currently have this array which repeats recursively:
[
{
"Name": "Test",
"Children": [
{
"Name": "Id",
"Property": "Placeholder",
"Children": [
{
"Name": "Child Id",
"Property": "Placeholder",
"Children": null
}
]
}
}
]
To get the structure I want I currently have this:
const fixed = data.map(item => item = {
data: {
name: item.Name,
},
children: item.Children.map(child => child = {
name: child.Name,
})
}
)
Is there a way to repeat my initial array.map recursively for each child array?