within the python script i've aws-cli command to print ec2 information
def ec2Output = sh(returnStdout: true, script: "aws ec2 describe-instances --region ${Region} --filters Name=tag:Environment,Values=${Environment} --query 'Reservations[].Instances[].[Tags[?Key==`Version`].Value|[0],InstanceId]'")
echo "${ec2Output}"
then i get the following output from the above command
[
[
"2023_v1",
"i-0xxxxxxxxxx"
"Dev"
],
[
"2023_v2",
"i-0xxxxxxxxxx"
"Dev"
],
[
"2023_v2",
"i-xxxxxxxxxx"
"Prod"
]
]
the question, is it possible that the output can be converted to something like the following ,expected result:
{
"Dev":{
"Release": "2023",
"Version": "v1",
"ID": "i-0xxxxxxxxxx"
},
"Dev":{
"Release": "2023",
"Version": "v2",
"ID": "i-0xxxxxxxxxx"
},
"Prod":{
"Release": "2023",
"Version": "v2",
"ID": "i-xxxxxxxxxx"
}
}