Thanks for answer
But I mean case when need need tree by different field names with child items.
for example, how to build tree for next object without modifying:
{
id: 1,
name: "name 1",
level1: [{
id: 2,
name: "name 2"
},{
id: 3,
name: "name 3",
level2:[{
id: 4,
name: "name 4"
},{
id: 5,
name: "name 5"
},{
id: 6,
name: "name 6",
level3:[{
id: 7,
name: "name 7"
},{
id: 8,
name: "name 8"
},{
id: 9,
name: "name 9",
}]
}]
},{
id: 10,
name: "name 10"
}]
}
Thanks