How can I transform the JSON input
{
"Subnets": [
{
"VpcId": "vpc-xxx",
"Tags": [
{
"Value": "staging_subnet_private_a",
"Key": "Name"
}
],
"SubnetId": "subnet-xxx"
},
...
]
}
to
[
{
"SubnetId": "subnet-xxx",
"Name": "staging_subnet_private_a"
},
...
]
using jq?
I have a working solution using jq '[.Subnets[] | {SubnetId, Name: .Tags[0] | .Value }]', but this relies on the order of Tags (not good).
Could I use from_entires or reduce maybe?