title: Hierarchical Tree using Unordered array
body: <p>I have an unordered array. <code>id</code> is a unique value.<code>parent</code> is id of parent. I need a Hierarchical JSON.</p>
  
  <pre><code>var C=[
          {
          "id": 57,
          "name": "Breaded Chicken Items",
          "slug": "breaded-chicken-items",
          "parent": 55,
          "description": "",
          "display": "default",
          "image": "http://coitor.com/emke/wp-content/uploads/2016/05/mainbanner-2.jpg",
          "count": 0
          },
          {
          "id": 70,
          "name": "Curry Masala Blends",
          "slug": "curry-masala-blends",
          "parent": 69,
          "description": "",
          "display": "default",
          "image": "http://coitor.com/emke/wp-content/uploads/2016/04/purto-probatus.jpg",
          "count": 0
          },
          {
          "id": 55,
          "name": "Fish | Meat | Frozen Veg",
          "slug": "fish-meat-frozen-veg",
          "parent": 0,
          "description": "",
          "display": "default",
          "image": "http://coitor.com/emke/wp-content/uploads/2016/05/mainbanner-2.jpg",
          "count": 0
          },
          {
          "id": 186,
          "name": "Frozen Veg",
          "slug": "frozen-veg",
          "parent": 55,
          "description": "",
          "display": "default",
          "image": "http://coitor.com/emke/wp-content/uploads/2016/05/mainbanner-1.jpg",
          "count": 0
          },
          {
          "id": 69,
          "name": "Spices | Curry Powders",
          "slug": "spices-curry-powders",
          "parent": 0,
          "description": "",
          "display": "default",
          "image": "http://coitor.com/emke/wp-content/uploads/2016/04/rsz_birds_eye_chilli.jpg",
          "count": 0
          },
          {
          "id": 47,
          "name": "Vegetables",
          "slug": "vegetables",
          "parent": 0,
          "description": "",
          "display": "subcategories",
          "image": "http://coitor.com/emke/wp-content/uploads/2016/04/wisi-antiopam.jpg",
          "count": 15
          },
          {
          "id": 72,
          "name": "Whole Spices",
          "slug": "whole-spices",
          "parent": 69,
          "description": "",
          "display": "default",
          "image": "http://coitor.com/emke/wp-content/uploads/2016/04/fresh-greenpeas.jpg",
          "count": 0
          }
          ]
  </code></pre>
  
  <p>Like this output</p>
  
  <pre><code>  [{
      "id": 55,
      "name": "Fish | Meat | Frozen Veg",
      "slug": "fish-meat-frozen-veg",
      "parent": 0,
      "description": "",
      "display": "default",
      "image": "http://coitor.com/emke/wp-content/uploads/2016/05/mainbanner-2.jpg",
      "count": 0
      "Children":[
           {
              "id": 57,
              "name": "Breaded Chicken Items",
              "slug": "breaded-chicken-items",
              "parent": 55,
              "description": "",
              "display": "default",
              "image": "http://coitor.com/emke/wp-content/uploads/2016/05/mainbanner-2.jpg",
              "count": 0
           }
       ]
     }]..etc
  </code></pre>
  
  <p>I have no idea.</p>