Try to search your question here, if you can't find : Ask Any Question Now ?

Create list menu from json response

HomeCategory: stackoverflowCreate list menu from json response
Avatarpushpa asked 2 weeks ago

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>
1 Answers
Best Answer
AvatarJyoti answered 2 weeks ago
Your Answer

1 + 13 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com