python使⽤json实现树结构_js怎样将获取json转换为树形结构最近elementUI的级联选择器要⽤到 根据国内外⽅案 做了⼀个我需要的!
var list = [
{
"ID": 1,
"FatherID": 0,
"TypeName": "风电",
"SortID": 2,
"Depth": 0,
"RootID": 1,
"IsFather": true
},
{
"ID": 2,
"FatherID": 1,
"TypeName": "风⼒发电",
"SortID": 11,
"Depth": 1,
"RootID": 1,
"IsFather": false
},
{
"ID": 13,
"FatherID": 1,
"TypeName": "风电整机",
"SortID": 13,
js获取json的key和value"Depth": 1,
"RootID": 1,
"IsFather": false
},
{
"ID": 23,
"FatherID": 1,
"Depth": 1,
"RootID": 1,
"IsFather": false
},
{
"ID": 33,
"FatherID": 1, "TypeName": "发电机及元件", "SortID": 15,
"Depth": 1,
"RootID": 1,
"IsFather": false
},
{
"ID": 44,
"FatherID": 1, "TypeName": "塔筒/塔架", "SortID": 16,
"Depth": 1,
"RootID": 1,
"IsFather": false
},
{
"ID": 54,
"FatherID": 1, "TypeName": "控制系统", "SortID": 18,
"Depth": 1,
"RootID": 1,
"IsFather": false
},
{
"TypeName": "核电", "SortID": 4,
"Depth": 0, "RootID": 65, "IsFather": true
},
{
"ID": 77,
"FatherID": 65, "TypeName": "核电站", "SortID": 651, "Depth": 1, "RootID": 65, "IsFather": false
},
{
"ID": 66,
"FatherID": 65, "TypeName": "核电设备", "SortID": 652, "Depth": 1, "RootID": 65, "IsFather": false
},
{
"ID": 91,
"FatherID": 65, "TypeName": "核电⼯程", "SortID": 653, "Depth": 1, "RootID": 65, "IsFather": false
{
"ID": 103,
"FatherID": 0, "TypeName": "⽔电", "SortID": 3,
"Depth": 0,
"RootID": 103,
"IsFather": true
},
{
"ID": 117,
"FatherID": 103, "TypeName": "⽔电站", "SortID": 1031,
"Depth": 1,
"RootID": 103,
"IsFather": false
},
{
"ID": 104,
"FatherID": 103, "TypeName": "⽔电设备", "SortID": 1032,
"Depth": 1,
"RootID": 103,
"IsFather": false
},
{
"ID": 130,
"FatherID": 103, "TypeName": "⽔利⽔电设计院", "SortID": 1033,
"Depth": 1,
"IsFather": false
},
{
"ID": 136, "FatherID": 103, "TypeName": "⽔电⼯程", "SortID": 1034, "Depth": 1, "RootID": 103, "IsFather": false
},
{
"ID": 699, "FatherID": 0, "TypeName": "环保", "SortID": 6,
"Depth": 0, "RootID": 699, "IsFather": true
},
{
"ID": 700, "FatherID": 699, "TypeName": "⽔处理", "SortID": 6991, "Depth": 1, "RootID": 699, "IsFather": true
},
{
"ID": 720, "FatherID": 699, "TypeName": "脱硫脱硝",