
Jaky napsat script v JS který vygeneruje takový objekt
Ahoj chlapy, stáhl jsem si z webu free API která vykresluje elementy které se získávají z objektu data (viz níže). Problém je v tom, že pokud chci přidat +/- 100 elementů do tohoto objektu i daleko hlouběji vnořených tak to spíš umřu, už je to nepřehledný teď. Neexistuje nějaký pomocník kterým by to šlo lehce vygenerovat z nějakého přehledného formátu? Velmi děkuji za pomoc!
var data = [
{
description: "Element ROOT",
children: [
{
description: "Element 1",
children: [
{
description: "Element 1.1",
children: []
},
{
description: "Element 1.2",
children: [
{
description: "Element 1.2.1",
children: []
}
]
}
]
},
{
description: "Element 2",
children: [
{
description: "Element 2.1 with tooltip",
tooltip: "Hey I'm a tooltip",
children: []
},
{
description: "Element 2.2",
children: []
}
]
},
{
description: "Element 3",
children: [
{
description: "Element 3.1",
children: []
},
{
description: "Element 3.2",
children: []
},
{
description: "Element 3.3",
children: [
{
description: "Element 3.3.1",
children: []
},
{
description: "Element 3.3.2",
children: []
}
]
}
]
}
]
}
];