首页 > 代码库 > Json转string对象 打印输出; String 转json数组

Json转string对象 打印输出; String 转json数组

后台json转成string对象的形式打印输出

success:function(json){

    JSON.stringify(json)
}


打印形式

[{"id":"3","text":"主页","FUN_ID":"3","FUN_CD":"5","pid":"","FUN_NM":"主页"},{"id":"5","text":"用户权限管理","nodes":[{"pid":5,"id":4,"text":"用户管理","FUN_ID":4,"FUN_CD":"4","FUN_NM":"用户管理"},{"pid":5,"id":1,"text":"角色管理","FUN_ID":1,"FUN_CD":"1","FUN_NM":"角色管理"},{"pid":5,"id":2,"text":"功能管理","FUN_ID":2,"FUN_CD":"3","FUN_NM":"功能管理"}],"FUN_ID":"5","FUN_CD":"2","pid":"","FUN_NM":"用户权限管理"},{"id":"7","text":"测试文件夹1","nodes":[{"pid":7,"id":10,"text":"测试文件夹23","FUN_ID":10,"FUN_CD":"CSWJJ23","FUN_NM":"测试文件夹23"},{"pid":7,"id":8,"text":"测试模块21","FUN_ID":8,"FUN_CD":"CEMK21","FUN_NM":"测试模块21"},{"pid":7,"id":9,"text":"测试模块22","FUN_ID":9,"FUN_CD":"CSMK22","FUN_NM":"测试模块22"}],"FUN_ID":"7","FUN_CD":"CSWJJ1","pid":"","FUN_NM":"测试文件夹1"}]


后端得到的String转成json数组的形式打印输出

JSON.parse(list)


打印形式

[5,4,3,2,1]


本文出自 “yipaixiaoyayin” 博客,请务必保留此出处http://yipaixiaoyayin.blog.51cto.com/8812323/1910145

Json转string对象 打印输出; String 转json数组