I have a json as mentioned in the first section and i want to add an element("image": "<IMAGE1_NAME>",) in the json as specified in the expected output.
I tired to use jq like this:
'.containerDefinitions += {"operation":"delete"}'
but this seem to not work. can anyone help me the jq command to achieve the result i want.
{
"taskDefinitionArn": "arn:aws",
"containerDefinitions": [
{
"name": "dev-service",
"cpu": 0,
"portMappings": [
{
"containerPort": 8080,
"hostPort": 8080,
"protocol": "tcp"
}
],
"essential": true,
"environment": [
{
"name": "message",
"value": "Hi, EMC!!"
}
]
}
}
]
}
expected output :
{
"taskDefinitionArn": "arn:aws:ecs:us-west-2:619867110810:task-definition/emc-dev-backend:30",
"containerDefinitions": [
{
"name": "dev-service",
"image": "<IMAGE1_NAME>",
"cpu": 0,
"portMappings": [
{
"containerPort": 8080,
"hostPort": 8080,
"protocol": "tcp"
}
],
"essential": true,
"environment": [
{
"name": "message",
"value": "Hi, EMC!!"
}
]
}
}
]
}