There are 2 multi-dimensional objects with different depths.
you need to combine them into one object
tried to use the Object.assign function, but without success If the title is different then you need to write them. And if the same leave 1 sample objects:
{
"title":"Cars",
"children":[
{
"title":"Stars",
"children":[
{
"title":"Fuel","children":[
{
"title":"132"
}
]
}
]
}
],
"title":"Cars",
"children":[
{
"title":"Stars",
"children":[
{
"title":"Power","children":[
{
"title":"Yes"
}
]
}
]
}
]
}
expected result:
{
"title":"Cars",
"children":[
{
"title":"Stars",
"children":[
{
"title":"Fuel",
"children":[
{
"title":"132"
}
],
"title":"Power",
"children":[
{
"title":"Yes"
}
]
}
]
}
]
}