{
"name": "paragraph",
"fullName": "paragraph",
"description": "",
"varType": "paragraph",
"type": 4,
"sampleIndex": 0
}, {
"name": "$intf",
"fullName": "paragraph.$intf",
"description": "",
"varType": "string",
"type": 2,
"sampleIndex": 0
}, {
"name": "$mtu",
"fullName": "paragraph.$mtu",
"description": "",
"varType": "int",
"type": 1,
"sampleIndex": 0
}, {
"name": "$bw",
"fullName": "paragraph.$bw",
"description": "",
"varType": "int",
"type": 1,
"sampleIndex": 0
}, {
"name": "SubParagraph",
"fullName": "paragraph.SubParagraph",
"description": "",
"varType": "paragraph",
"type": 4,
"sampleIndex": 0
}, {
"name": "$subId",
"fullName": "paragraph.SubParagraph.$subId",
"description": "",
"varType": "string",
"type": 2,
"sampleIndex": 0
}
利用fullName表示的关系,一个 . 代表一级
如何将上面的数据转换成类似下面的格式:
{
name: "bgp_rid",
type: "single",
draggable: true
}, {
name: "bgp_nbrs",
type: "table",
children: [{
name: "bgp_rid1",
type: "single",
draggable: true
}, {
name: "bgp_nbrs1",
type: "table",
draggable: true
}, {
name: "bgp_nbrs1",
type: "interface_table",
children: [{
name: "bgp_rid1",
type: "single",
draggable: true
}, {
name: "bgp_nbrs1",
type: "table",
draggable: true,
children: [{
name: "bgp_rid1",
type: "single",
draggable: true
}, {
name: "bgp_nbrs1",
type: "table",
draggable: true
}]
}]
}]
}
这个好像能用