title: Append an array to a json using jq in BASH
body: <p>I have a json that looks like this:</p>
  
  <pre><code>{
      "failedSet": [],
      "successfulSet": [{
          "event": {
              "arn": "arn:aws:health:us-east-1::event/AWS_RDS_MAINTENANCE_SCHEDULED_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
              "endTime": 1502841540.0,
              "eventTypeCategory": "scheduledChange",
              "eventTypeCode": "AWS_RDS_MAINTENANCE_SCHEDULED",
              "lastUpdatedTime": 1501208541.93,
              "region": "us-east-1",
              "service": "RDS",
              "startTime": 1502236800.0,
              "statusCode": "open"
          },
          "eventDescription": {
              "latestDescription": "We are contacting you to inform you that one or more of your Amazon RDS DB instances is scheduled to receive system upgrades during your maintenance window between August 8 5:00 PM and August 15 4:59 PM PDT. Please see the affected resource tab for a list of these resources. \r\n\r\nWhile the system upgrades are in progress, Single-AZ deployments will be unavailable for a few minutes during your maintenance window. Multi-AZ deployments will be unavailable for the amount of time it takes a failover to complete, usually about 60 seconds, also in your maintenance window. \r\n\r\nPlease ensure the maintenance windows for your affected instances are set appropriately to minimize the impact of these system upgrades. \r\n\r\nIf you have any questions or concerns, contact the AWS Support Team. The team is available on the community forums and by contacting AWS Premium Support. \r\n\r\nhttp://aws.amazon.com/support\r\n"
          }
      }]
  }
  </code></pre>
  
  <p>I'm trying to add a new key/value under <code>successfulSet[].event</code> (key name as <code>affectedEntities</code>) using jq, I've seen some examples, like <a href="https://stackoverflow.com/a/39016052/4557537">here</a> and <a href="https://stackoverflow.com/questions/39015374/changing-the-json-using-jq-in-bash">here</a>, but none of those answers really show how to add a possible one key with multiple values (the reason why I say possible is because as of now, AWS is returning one value for the affected entity, but if there are more, then I'd like to list them).</p>
  
  <p>EDIT: The value of the new key that I want to add is stored in a variable called <code>$affected_entities</code> and a sample of that value looks like this:</p>
  
  <pre><code>[
      "arn:aws:acm:us-east-1:xxxxxxxxxxxxxx:certificate/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
  ]
  </code></pre>
  
  <p>The value could look like this:</p>
  
  <pre><code>[
      "arn:aws:acm:us-east-1:xxxxxxxxxxxxxx:certificate/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx", 
      "arn:aws:acm:us-east-1:xxxxxxxxxxxxxx:certificate/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
      ...
      ...
      ...
  ]
  </code></pre>