json構造をjson構造を単純なオブジェクトの配列に変換するために 'jq' json processorを使いたいと思います。jqで多次元配列を作成する
{"nsgs": [
{
"comments": "text1",
"properties": {
"securityRules": [
{
"name": "1",
"properties": {
"protocol": "TCP",
"sourcePortRange": "*"
}
},
{
"name": "2",
"properties": {
"protocol": "UDP",
"sourcePortRange": "*"
}
}
]
}
},
{
"comments": "text2",
"properties": {
"securityRules": [
{
"name": "3",
"properties": {
"protocol": "TCP",
"sourcePortRange": "*"
}
},
{
"name": "4",
"properties": {
"protocol": "UDP",
"sourcePortRange": "*"
}
}
]
}
}
]}
そして、何私が取得したいことは次のとおりです:
私の構造は、このようなものです
[
{ "comments": "text1",
"name": "1",
"protocol": "TCP",
"sourcePortRange": "*"
},
{ "comments": "text1",
"name": "2",
"protocol": "UDP",
"sourcePortRange": "*"
},
{ "comments": "text2",
"name": "3",
"protocol": "TCP",
"sourcePortRange": "*"
},
{ "comments": "text2",
"name": "4",
"protocol": "UDP",
"sourcePortRange": "*"
}
]
私はアプローチの多くを試みたが、何も助けません。
助けていただければ幸いです。
は、優れたソリューションをありがとう! –