title: null array problem in json
body: <p>I have written a function which scans all the files/directory in a given directory and returns a json object. I need to display this json object on the UI using jstree. I have written the function in go using recursion to scan all the files and directories rooted at that particular folder. </p>
  
  <p>This is the type I am using to construct the whole structure</p>
  
  <pre><code>type Directory struct {
      Name string "data"
      SubDirs []Directory "children"
  }
  </code></pre>
  
  <p>Now jstree accepts data structs of the following format.</p>
  
  <pre><code>json_data: {
          data: [
              "f1",
              "f2",
              {
                  data: "f3",
                  children: ["f4", "f5"]
              }
          ]
   }
  </code></pre>
  
  <p>and not of the format :-</p>
  
  <pre><code>json_data: {
          data: [
              {
                "data": "f1",
                "children": []
              } 
              {
                "data": "f2",
                "children": []
              } 
              {
                  data: "f3",
                  children: ["f4", "f5"]
              }
          ]
   }
  </code></pre>
  
  <p>(when I pass the above data structure format, it doesn't work probably since the "children" thing is null)</p>
  
  <p>Thus the data structure Directory I have maintained doesn't suffice to construct the directory structure.</p>
  
  <p>How do I solve this problem of constructing the Directory tree homogeneously?</p>