Function ajaxGetMenuList () {$. getJSON ("login. do ", function (json) {var r =" "; zNodes + =" ["; $ (json. menuList ). each (function (I) {r = json. menuList [I]; if (I> 0) zNodes + = ","; zNodes + = '{'; zNodes + = 'id: '+ r. SId; zNodes + = ', pId:' + r. SPid; zNodes + = ', name: "' + r. STitle; if (r. SPid = 0) zNodes + = '", open: true'; else zNodes + ='" '; zNodes + ='} ';}) zNodes + = "]"; zNodes = stringToJSON (zNodes); createTree (zNodes );}/*** Convert json to String * @ param {Object} obj * @ memberOf {TypeName} * @ return {TypeName} */function jsonToString (obj) {var THIS = this; switch (typeof (obj) {case 'string': return '"' + obj. replace (/(["\])/g, '\ $1') + '"'; case 'array': return '[' + obj. map (THIS. jsonToString ). join (',') + ']'; case 'object': if (obj instanceof Array) {var strArr = []; var len = obj. length; for (var I = 0; I <len; I ++) {strArr. push (THIS. jsonToString (obj [I]);} return '[' + strArr. join (',') + ']';} else if (obj = null) {return 'null';} else {var string = []; for (var property in obj) string. push (THIS. jsonToString (property) + ':' + THIS. jsonToString (obj [property]); return '{' + string. join (',') + '}';} case 'number': return obj; case false: return obj ;}} /*** convert String to json * @ param {Object} obj * @ return {T YpeName} */function stringToJSON (obj) {return eval ('+ obj +');} // judge the object type function getType (x) {& nbsp; & nbsp; if (x = null) {& nbsp; & nbsp; return "null"; & nbsp; & nbsp; & nbsp ;}& nbsp; & nbsp; & nbsp; var t = typeof x; & nbsp; & Nbsp; if (t! = "Object") {& nbsp; & nbsp; return t; & nbsp ;}& nbsp; & nbsp; & nbsp; var c = Object. prototype. toString. apply (x); & nbsp; c = c. substring (8, c. length-1); & nbsp; if (c! = "Object") {& nbsp; & nbsp; return c; & nbsp ;}& nbsp; & nbsp; & nbsp; if (x. constructor = Object) {& nbsp; & nbsp; return c & nbsp; & nbsp ;}& nbsp; & nbsp; & nbsp; if ("classname" in x. prototype. constructor & nbsp; & nbsp; & typeof x. prototype. constructor. classname = "string") {& nbsp; & nbsp; return x. constructor. prototype. classname; & nbsp ;}& nbsp; & nbsp; & nbsp; return "<unknown type>"; & nbsp; & nbsp ;}