I have a JavaScript object that looks as follows:
var obj = {
"id": 1098
"someData": {},
"children": [
{
"id": 2124
"someData": {},
"children": [...]
},
{
"id": 1298,
"someData": {},
"children": [
{
"id": 1290,
"someData": {},
"children": [...]
}
]
]
}
As you can see the parent is always an object with an id, some data and children that have the same structure as the parent. In theory it can be nested infinitely.
I need two operations now: add and delete somewhere in this structure.
"Add this object as a child of the parent with the id 1298"
"Remove the object with the id 2124"
Maybe there is even a framework that works with recursive data?