I've searched far and wide but can't seem to be able to find what I think is a sort of recursive alphabetize of an array withing arrays of objects in Javascript.
Almost every object in the array has an array which has multiple objects that also have multiple arrays.
I'm looking to just alphabetize each array by the object's name, but also look inside the objects to see if they have arrays that need to be alphabetized, and so on and so on.
Example data:
{
name: "Zero",
children: [
{
name: "Omega",
children: [
{
name: "Harold",
children: [{etc}]
}
]
}
name:"Beta",
children: [{etc}]
}
]
I want to keep this same lay-out of the data while sorting each of the children alphabetically by name.
Example output:
{
name: "Zero",
children: [
{
name: "Beta",
children: [{etc}]
}
name:"Omega",
children: [
{
name: "Harold",
children: [{etc}]
}
]
}
}
]
Not just for the children of Zero
but for every single children array there is inside each of the children, inside those and inside those.