title: parent child relation sorting in javascript
body: <p>I have the following structure </p>
  
  <pre><code>[
      {
           "category_id" : 1,
           "parent_category" : null
      } ,
      {
           "category_id" : 2,
           "parent_category" : 1
      },
      {
           "category_id" : 3,
           "parent_category" : 1
      },
      {
           "category_id" : 4,
           "parent_category" : 2
      },
      ,
      {
           "category_id" : 5,
           "parent_category" : null
      },
      ,
      {
           "category_id" : 6,
           "parent_category" : 5
      }
  
  
  ]
  </code></pre>
  
  <p>so I have parent children relation , I want to sort it with the following 
  structure </p>
  
  <pre><code>[
      {
        "parent_category":[ "array of all children that follow this main parent category" ]  
      },
      {},
      {}
  ]
  </code></pre>
  
  <p>I,ve seen many solution but all of it about tree structure output</p>
  
  <p>Thanks </p>