I'm sure this has been answered, but I can only find similar questions.. nothing which actually answers mine.
I have some JSON..
example:
{
"Name": "test.example.net.",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "XXX12345XX54321",
"DNSName": "test.example.net.us-east-1.elb.amazonaws.com.",
"EvaluateTargetHealth": false
}
},
I want to return the Name, Type & DNSName only.
I've got close with..
.ResourceRecordSets[] | "\(.Name) \t\(.Type) \t\(.AliasTarget)"
But that returns the entire array AliasTarget
- I'm trying to work out the correct syntax to pick out just DNSName
Any ideas?
CodePudding user response:
You'll need .AliasTarget.DNSName
to get the .DNSName
inside the .AliasTarget
object:
.ResourceRecordSets[] | "\(.Name) \t\(.Type) \t\(.AliasTarget.DNSName)"
"test.example.net. \tA \ttest.example.net.us-east-1.elb.amazonaws.com."