{"id":1607,"date":"2015-12-21T16:34:53","date_gmt":"2015-12-21T08:34:53","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=1607"},"modified":"2023-10-31T15:43:10","modified_gmt":"2023-10-31T07:43:10","slug":"jstree-populating-the-tree-using-json","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1607","title":{"rendered":"[jsTree] Populating the tree using JSON"},"content":{"rendered":"<ul>\n<li>\n<p>Using Json<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"\">$(&#039;#using_json&#039;).jstree({ &#039;core&#039; : \n{\n    &#039;data&#039; : [\n        &#039;Simple root node&#039;,\n        {\n            &#039;text&#039; : &#039;Root node 2&#039;,\n            &#039;state&#039; : {\n                &#039;opened&#039; : true,\n                &#039;selected&#039; : true\n            },\n            &#039;children&#039; : [\n                { &#039;text&#039; : &#039;Child 1&#039; },\n                &#039;Child 2&#039;\n            ]\n        }\n    ]\n} });<\/pre>\n<\/li>\n<li>\n<p>Using the alternative JSON format<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"\">$(&#039;#using_json&#039;).jstree({ &#039;core&#039; : {\n    &#039;data&#039; : [\n        { &quot;id&quot; : &quot;ajson1&quot;, &quot;parent&quot; : &quot;#&quot;, &quot;text&quot; : &quot;Simple root node&quot; },\n        { &quot;id&quot; : &quot;ajson2&quot;, &quot;parent&quot; : &quot;#&quot;, &quot;text&quot; : &quot;Root node 2&quot; },\n        { &quot;id&quot; : &quot;ajson3&quot;, &quot;parent&quot; : &quot;ajson2&quot;, &quot;text&quot; : &quot;Child 1&quot; },\n        { &quot;id&quot; : &quot;ajson4&quot;, &quot;parent&quot; : &quot;ajson2&quot;, &quot;text&quot; : &quot;Child 2&quot; },\n    ]\n} });<\/pre>\n<\/li>\n<\/ul>\n<p>Ref. <a href=\"https:\/\/www.jstree.com\/docs\/json\/\">Populating the tree using JSON<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Json $(&#039;#using_json&#039;).jstree({ &#039;core&#039; : { &#039;data&#039; : [ &#039;Simple root node&#039;, { &#039;text&#039; : &#039;Root node 2&#039;, &#039;state&#039; : { &#039;opened&#039; : true, &#039;selected&#039; : true }, &#039;children&#039; : [ { &#039;text&#039; : &#039;Child 1&#039; }, &#039;Child 2&#039; ] &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1607\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-1607","post","type-post","status-publish","format-standard","hentry","category-jstree"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1607"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1607\/revisions"}],"predecessor-version":[{"id":1885,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1607\/revisions\/1885"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}