var data=[ ???{accounts :[], ???attrs : {maxmailboxsize: "-1", maxusers: "-1"}, ???fullpath : "",id :"og59fdbc30578", ???modifytime : "", name:"123", poid : "", children : []}, ???{accounts :[], ???????attrs : {maxmailboxsize: "-1", maxusers: "-1"}, ???????fullpath : "",id :"og59fdbc30578", ???????modifytime : "", ???????name:"开发部", ???????poid : "", ???????children : [{ ???????????accounts :[], ???????????attrs : {maxmailboxsize: "开发部1", maxusers: "-1"}, ???????????fullpath : "",id :"og59fdbc30578", ???????????modifytime : "", ???????????name:"开发部1", ???????????poid : "", ???????????children : [{accounts :[], ???????????????attrs : {maxmailboxsize: "开发部11", maxusers: "-1"}, ???????????????fullpath : "",id :"og59fdbc30578", ???????????????modifytime : "", ???????????????name:"开发部11", ???????????????poid : "", ???????????????children : [{ ???????????????????accounts :[], ???????????????????attrs : {maxmailboxsize: "-1", maxusers: "-1"}, ???????????????????fullpath : "",id :"og59fdbc30578", ???????????????????modifytime : "", ???????????????????name:"开发部111", ???????????????????poid : "", ???????????????????children : [{ ???????????????????????accounts :[], ???????????????????????attrs : {maxmailboxsize: "-1", maxusers: "-1"}, ???????????????????????fullpath : "",id :"og59fdbc30578", ???????????????????????modifytime : "", ???????????????????????name:"开发部1111", ???????????????????????poid : "", ???????????????????????children : [{ ???????????????????????????accounts :[], ???????????????????????????attrs : {maxmailboxsize: "-1", maxusers: "-1"}, ???????????????????????????fullpath : "",id :"og59fdbc30578", ???????????????????????????modifytime : "", ???????????????????????????name:"开发部1111", ???????????????????????????poid : "", ???????????????????????????children : [{ ???????????????????????????????accounts :[], ???????????????????????????????attrs : {maxmailboxsize: "-1", maxusers: "-1"}, ???????????????????????????????fullpath : "",id :"og59fdbc30578", ???????????????????????????????modifytime : "", ???????????????????????????????name:"开发部111111", ???????????????????????????????poid : "", ???????????????????????????????children : [] ???????????????????????????}] ???????????????????????}] ???????????????????}] ???????????????}] ???????????}] ???????}] ???}];if(data != "" && data.length>0){ ???for(var i=0;i<data.length;i++){ ?????console.log(data[i]); ?????var s = data[i]; ?????s["subditems"]=s.children; ???????console.log(s); ???}}console.log(data);
添加json属性并赋值或修改json属性(ztree树形结构)
原文地址:http://www.cnblogs.com/zsy0712/p/7845862.html