当前位置:首页>开发>正文

js怎样将获取json转换为树形结构 java和json 树形菜单

2023-04-23 06:13:18 互联网 未知 开发

 js怎样将获取json转换为树形结构 java和json 树形菜单

js怎样将获取json转换为树形结构

比如这样一段json
{
"name":"1级菜单1",
"link":"###",
"isleaf": false,
"level": 0,
"children": [
{
"name":"2级菜单1",
"link":"###",
"isleaf": false,
"level": 1,
"children": [
{
"name":"3级菜单1",
"link":"###",
"isleaf": true,
"level": 2,
"children": null
},
{
"name":"3级菜单2",
"link":"###",
"isleaf": true,
"level": 2,
"children": null
}
]
},
{
"name":"2级菜单2",
"link":"###",
"isleaf": false,
"level": 1,
"children": [
{
"name":"3级菜单3",
"link":"###",
"isleaf": true,
"level": 2,
"children": null
}
]
}
]
}

我怎样把他转换成


一级菜单

java和json 树形菜单

....有很多类似的功能包啊....比如net.sf.json.util.JSONUtils之类的...很容易把list转json.如需要请yjjidt888@126.com有现成类