title: how to export jstree desired json formatted from etrepat/baum laravel package
body: <p>I am using <a href="https://www.jstree.com" rel="nofollow">jstree jQuery plugin</a> to display Categories as tree view. </p>
  
  <p>And in the backend, I am using <a href="https://github.com/etrepat/baum" rel="nofollow">etrepat/baum</a> laravel package to create categories nested sets. </p>
  
  <p><strong>etrepat/baum</strong> package has a method named <a href="https://github.com/etrepat/baum#dumping-the-hierarchy-tree" rel="nofollow">toHierarchy()</a> which  returns a nested collection representing the queried tree.  </p>
  
  <p>the format of returned is like :</p>
  
  <pre><code>    {  
     "7":{  
        "org_level_id":7,
        "parent_id":5,
        "lft":7,
        "rgt":12,
        "depth":0,
        "name":"Computer",
        "created_at":"2015-11-02 00:45:01",
        "updated_at":"2015-11-02 00:45:01",
        "children":[  
           {  
              "org_level_id":14,
              "parent_id":7,
              "lft":8,
              "rgt":9,
              "depth":1,
              "name":"hard",
              "created_at":"2015-11-02 00:45:01",
              "updated_at":"2015-11-02 00:45:01",
              "children":[  
  
              ]
           },
           {  
              "org_level_id":13,
              "parent_id":7,
              "lft":10,
              "rgt":11,
              "depth":1,
              "name":" RAM",
              "created_at":"2015-11-02 00:45:01",
              "updated_at":"2015-11-02 00:45:01",
              "children":[  
  
              ]
           }
        ]
     },
     "9":{  
        "org_level_id":9,
        "parent_id":2,
        "lft":20,
        "rgt":23,
        "depth":0,
        "name":"search engines",
        "created_at":"2015-11-02 00:45:01",
        "updated_at":"2015-11-02 00:45:01",
        "children":[  
           {  
              "org_level_id":18,
              "parent_id":9,
              "lft":21,
              "rgt":22,
              "depth":1,
              "name":"Google",
              "created_at":"2015-11-02 00:45:01",
              "updated_at":"2015-11-02 00:45:01",
              "children":[  
  
              ]
           }
        ]
     },
     "17":{  
        "org_level_id":17,
        "parent_id":10,
        "lft":25,
        "rgt":26,
        "depth":0,
        "name":"Download",
        "created_at":"2015-11-02 00:45:01",
        "updated_at":"2015-11-02 00:45:01",
        "children":[  
  
        ]
     }
  }
  </code></pre>
  
  <p>While on other hand , <strong>JStree plugin</strong> is desired a json format like to create treeview from it : </p>
  
  <pre><code>[
     'Simple root node',
     {
       'text' : 'Root node 2',
       'state' : {
         'opened' : true,
         'selected' : true
       },
       'children' : [
         { 'text' : 'Child 1' },
         'Child 2'
       ]
    }
  ]
  </code></pre>
  
  <p>How can i convert return format of <strong>etrepat/baum</strong> to Appropriate format that <strong>jstree</strong> is desired ?</p>