title: Create a menu from JSON Array Javascript
body: <p>I want to create a menu from JSON Array</p>
  
  <p>JSON Array:</p>
  
  <pre><code>[{
      "page_id":"102608802958096849","title":"Submenu 1 1","page_order":1,"parent_id":"305280635460611248","layout":"header","page_url":"submenu-1-1.html"
  },{
      "page_id":"207782958260361106","title":"Submenu 2 1","page_order":1,"parent_id":"196241715470310788","layout":"header","page_url":"submenu-2-1.html"
  },{
      "page_id":"305280635460611248","title":"Submenu 1","page_order":1,"parent_id":"308333626876055885","layout":"header","page_url":"submenu-1.html"
  },{
      "page_id":"308333626876055885","title":"Demo","page_order":1,"parent_id":null,"layout":"header-slider","page_url":"index.html"
  },{
      "page_id":"357018431614169959","title":"Not Mega Menu","page_order":1,"parent_id":"756836287653398147","layout":"header","page_url":"not-mega-menu.html"
  },{
      "page_id":"363544895956322795","title":"Submenu 2 1 1","page_order":1,"parent_id":"207782958260361106","layout":"header","page_url":"submenu-2-1-1.html"
  },{
      "page_id":"130518632716609153","title":"New Page","page_order":2,"parent_id":"756836287653398147","layout":"header","page_url":"new-page.html"
  },{
      "page_id":"196241715470310788","title":"Submenu 2","page_order":2,"parent_id":"308333626876055885","layout":"header","page_url":"submenu-2.html"
  },{
      "page_id":"520778073299851538","title":"Submenu 2 2","page_order":2,"parent_id":"196241715470310788","layout":"header","page_url":"submenu-2-2.html"
  },{
      "page_id":"756836287653398147","title":"Phoenix","page_order":2,"parent_id":null,"layout":"header","page_url":"phoenix.html"
  },{
      "page_id":"951287960823231869","title":"Submenu 2 1 2","page_order":2,"parent_id":"207782958260361106","layout":"header","page_url":"submenu-2-1-2.html"
  }]
  </code></pre>
  
  <p>The expected menu I want to create look similar like this:</p>
  
  <p>HTML: </p>
  
  <pre><code>&lt;ul&gt;
  &lt;li&gt;
      &lt;a&gt;Demo&lt;/a&gt;
      &lt;div&gt;
          &lt;ul&gt;
              &lt;li&gt;
                  &lt;a&gt;Submenu 1&lt;/a&gt;
                  &lt;div&gt;
                      &lt;ul&gt;&lt;li&gt;&lt;a&gt;Submenu 1 1&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
              &lt;li&gt;
                  &lt;a&gt;Submenu 2&lt;/a&gt;
                  &lt;div&gt;
                      &lt;ul&gt;
                          &lt;li&gt;
                              &lt;a&gt;Submenu 2 1&lt;/a&gt;
                              &lt;div&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;
                                          &lt;a&gt;Submenu 2 1 1&lt;/a&gt;
                                      &lt;/li&gt;
                                      &lt;li&gt;
                                          &lt;a&gt;Submenu 2 1 2&lt;/a&gt;
                                      &lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/div&gt;
                          &lt;/li&gt;
                          &lt;li&gt;
                              &lt;a&gt;Submenu 2 2&lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
      &lt;a&gt;Phoenix&lt;/a&gt;
      &lt;div&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;a&gt;New Page&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a&gt;Not Mega Menu&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p></p>
  
  <p>Note that:</p>
  
  <p>With an example: "page_id":"102608802958096849","title":"Submenu 1 1","page_order":1,"parent_id":"305280635460611248","layout":"header","page_url":"submenu-1-1.html"</p>
  
  <p>page_id = 102608802958096849 (define id of menu)</p>
  
  <p>title = Submenu 1 1 (title)</p>
  
  <p>page_order = 1 (menu:nth-child(1))</p>
  
  <p>Any idea to build the menu above from JSON array ? Thanks in advance</p>