I am working on a project where I am getting the JSON output below and want to create a menu from it. Group having parent and child menu using JavaScript:
myArray = [
{group: "one", color: "red"},
{group: "two", color: "blue"},
{group: "one", color: "green"},
{group: "one", color: "black"}
]
I want the output below in html
One
red
green
black
Two
blue
<ul class="nested">one
<li><a href=“red”>red</li>
<li><a href=“green”>green</li>
<li><a href=“black”>black</li>
</ul>
<ul class="nested">two
<li><a href=“blue”>blue</li>
</ul>