jstree 返回的JSON字符串怎么拼写

{
"text": "一级机构",
"children":
[
{
"text": "二级机构",
"icon": "fa fa-folder icon-state-danger",
"state": {
"selected": true
}
},
{
"text": "二级机构",
"icon": "fa fa-folder icon-state-danger",
"children": [
{ "text": "三级机构", "icon": "fa fa-file icon-state-info" }
]
},
{
"text": "二级机构",
"icon": "fa fa-folder icon-state-danger"
},
{
"text": "二级机构",
"icon": "fa fa-folder icon-state-danger"
},
{
"text": "二级机构",
"icon": "fa fa-folder icon-state-danger",
"children": [
{ "text": "三级机构", "icon": "fa fa-file icon-state-info" },
{ "text": "三级机构", "icon": "fa fa-file icon-state-info" },
{ "text": "三级机构", "icon": "fa fa-file icon-state-info" },
{ "text": "三级机构", "icon": "fa fa-file icon-state-info" },
{ "text": "三级机构", "icon": "fa fa-file icon-state-info" }
]
}
]
}

“拼写”不知道是什么意思,你是要给jstree设置节点,还是要读取?

类似下面这样,你没有id的话可以去掉

    joinNode = function(nodeArray,$treeObject) {
        var i = 0, nodeArrayLength = nodeArray.length;
        var $tree = $("#jstree1");
        $tree.html();
        if($treeObject == null){
            $treeObject = $tree;
        }
         var ul = $("<ul></ul>");
          $treeObject.append(ul);
        for(i = 0; i < nodeArrayLength; i++) {
            var node = nodeArray[i], liHtml = '',
                       $ddItem, fatherId = node.fatherId, $ddList, template, $ddListInModal;
            if(node.children != null){
                var li = $("<li id="+ node.id +"></li>");
                $(li).append(node.name).appendTo(ul);
                joinNode(node.children,li);
            }else{//标签为<file name="***"/>,file一定是叶子节点
                var li = $("<li id="+ node.id +"></li>");
                $(li).append(node.name).appendTo(ul);
            }
        }
    };