I have a familytree looking like this:
{
"children": [{
"name": "bob",
"children": [{
"name": "sam",
"children": [{
"name": "mike",
"children": [{
"name": "elias",
"children": []
}, {
"name": "rodriguez",
"children": []
}]
}]
}]
}]
}
The main "children"
is an array containing nested child-arrays.
How can I remove an object from an array like this?
Lets say I want to remove the object with the name "sam", that should leave me with the following:
{
"children": [{
"name": "bob",
"children": []
}]
}
Its the nesting that trips me up and i do not understand how to start.
Any help or directions to a tutorial that deals with similar issues are appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…