能否请您指导如何将下面的所有属性组合为单个JSON列表/数组?
{
"results": [
{
"imdata": [
{
"l1PhysIf": {
"attributes": {
"dn": "topology/pod-1/node-1202/sys/phys",
"descr": ""
},
"children": [
{
"ethpmPhysIf": {
"attributes": {
"operSt": "up"
}
}
}
]
}
}
],
"item": {
"fabricNode": {
"attributes": {
"dn": "topology/pod-1/node-1202",
"name": "NOQC"
}
}
}
}
]
}
我尝试了如下命令。但它似乎不起作用
{dn:results[*].imdata[*].l1PhysIf.attributes.dn, desc:results[*].imdata[*].l1PhysIf.attributes.descr,operSt:results[*].imdata[*].l1PhysIf.children[0].ethpmPhysIf.attributes.operSt, node:results[].item.fabricNode.attributes.dn,name:results[].item.fabricNode.attributes.name}
但是所有的属性都进入单个数组,如下所示
{
"dn": [
[
"topology/pod-1/node-1202/sys/phys"
]
],
"desc": [
[
""
]
],
"operSt": [
[
"up"
]
],
"node": [
"topology/pod-1/node-1202"
],
"name": [
"NOQC"
]
}
请在预期结果下方找到:请帮助
{
"result":[
{
"dn": "topology/pod-1/node-1202/sys/phys",
"desc": "",
"operSt": "up",
"node": "topology/pod-1/node-1202",
"name": "NOQC"
}
]
}