Я хотел бы использовать процессор jq 'json для преобразования структуры json в массив простых объектов.Создать массив из многомерного с помощью 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": "*"
}
]
Я пробовал много подходов, но ничего не помогает.
Поймите любую помощь.
Спасибо, отличное решение! –