title: Need to Append Empty Array in JSON Multidimensional Array
body: <p>I am usign JSTree to show tree structure. Now I need to show selected parent/child when edit a record. For this I've below json that is required json to show selected parent/child node in tree.</p>
  
  <pre><code>varpathArray={
    "func_extensions_job": [
      {
        "CodiacSDK.NewModule.dll;extensionCreatePre;": [
          {
            "CodiacSDK.NewModule.dll;extensionInquirePost;": [
  
            ]
          }
        ]
      }
    ]
  };
  </code></pre>
  
  <p>But its static json and I need dynamic json to convert like above. Below is the json that I get via API response. Now I need to add an empty array at last value. </p>
  
  <pre><code>{"func_extensions_job":[{"CodiacSDK.NewModule.dll;extensionCreatePre;":[{"CodiacSDK.NewModule.dll;extensionExecutePost;":["CodiacSDK.PythonWrapper.dll;UnitValues::extensionExecutePre;"]}]}]}
  </code></pre>
  
  <p>I've this</p>
  
  <pre><code>["CodiacSDK.PythonWrapper.dll;UnitValues::extensionExecutePre;"]
  </code></pre>
  
  <p>That I need to convert in this</p>
  
  <pre><code>[{"CodiacSDK.NewModule.dll;extensionInquirePost;":[]}]
  </code></pre>
  
  <p>So is there any way that I can do it.</p>
  
  <p>I am using below function to generate my json array without empty object</p>
  
  <pre><code>var path = $("#testing").jstree().get_path($("#testing").jstree("get_selected", true)[0], '{/}').split('{/}');
  
              var resJson = {};
  
              console.log(JSON.stringify(resJson));
  
              for (var j = path.length; j &gt; 1; j--) {
                  //console.log(path[j - 2]);
  
                  if (path[j - 2] &amp;&amp; !Object.keys(resJson).length) {
                      resJson[path[j - 2]] = [path[j - 1]];
                  } else {
                      var temp = resJson;
                      resJson = {};
                      resJson[path[j - 2]] = [temp];
                  }
              }
  </code></pre>
  
  <p>Any help is appreciated. Thanks in advance.</p>