title: How to refresh a jsTree with new JSON data?
body: <p>I have a file upload element that scans the file names upon change and does something to get a valid <code>treeJSON</code> variable. When the function detects a change the second time, the <code>treeJSON</code> variable will update, and I need to update the tree.</p>
  <p>I've tried various methods such as <code>refresh()</code>, <code>destroy()</code> etc., but I haven't been able to construct a new tree on the same page without reloading the page. Here is a snippet, I've included all the functions and it works. The important part is working with the <code>treeJSON</code></p>
  <pre class="lang-js prettyprint-override"><code>input.onchange = function (e) {
    // do something
  };
  var treeJSON = someVar;
  
  $(&quot;#tree&quot;).jstree({
    core: {
      check_callback: true,
      data: treeJSON,
    },
  });
  </code></pre>