title: How to escape JSON in YAML
body: <p>Following command works on bash shell but YAML parser (bitbucket-pipelines.yaml) reports it as invalid syntax</p>
  
  <p><a href="https://bitbucket-pipelines.atlassian.io/validator" rel="nofollow noreferrer">https://bitbucket-pipelines.atlassian.io/validator</a></p>
  
  <p><code>- export TASK_VERSION=$(aws ecs register-task-definition --family MyTask --container-definitions "[{\"name\":\"MyContainer\",\"image\":\"1234567.dkr.ecr.us-west-1.amazonaws.com/ecs-repository:1.0.13\",\"cpu\":50,\"portMappings\": [{\"hostPort\": 80,\"containerPort\": 80,\"protocol\":\"tcp\"}],\"memory\":300}]" | jq --raw-output '.taskDefinition.revision')</code>   </p>
  
  <p>Even though I have escaped all double quotes using \ char, I think [ and { are throwing it off.</p>
  
  <p>Any ideas?</p>