[{"Availab]ilityZone": "ap-east-1a" "Description": "AWS_FOO" "Groups": [ {"GroupName": "AWS_FOO" "GroupId": "sg-AWS_FOO" } {"GroupName": "AWS_FOO" "GroupId": "sg-AWS_FOO" } ] } {"Availab]ilityZone": "ap-east-1a" "Description": "AWAWS_FOOAWS_FOO" "Groups": [ {"GroupName": "AWS_FOO-eAWS_FOOAWS_FOO" "GroupId": "sAWS_FOO" } {"GroupName": "AWS_FOO" "GroupId": "AWS_FOO" } ] }]
I am tring to write a automation script that required to use aws cli to find the values,
NETWORK_INTERFACE=$(aws ec2 describe-network-interfaces --filters Name=vpc-id,Values="${VPC_ID}" --output json | jq -r '.NetworkInterfaces[]')
However, when I echo $NETWORK_INTERFACEthe,the output will missing all commas "," , make it not a valid json format and cannot use jq to further action
I tried using IFS, sed but the result is not what I expected
My expected output is valid json like
[{"Availab]ilityZone": "ap-east-1a","Description": "AWS_FOO" ,"Groups": [ {"GroupName": "AWS_FOO" ,"GroupId": "sg-AWS_FOO", } , {"GroupName": "AWS_FOO" ,"GroupId": "sg-AWS_FOO", } ] }, {"Availab]ilityZone": "ap-east-1a","Description": "AWAWS_FOOAWS_FOO","Groups": [ {"GroupName": "AWS_FOO-eAWS_FOOAWS_FOO","GroupId": "sAWS_FOO", }, {"GroupName": "AWS_FOO","GroupId": "AWS_FOO", } ] }]