title: Adding property to objects before sending response
body: <p>I am trying to add another property to each object I receive from the DynamoDB table. I am trying to do this by altering each object in the Items array then adding the Items array to my responseBody. All I get in return is the original items without any new properties. This could be a product of me using the array functions or spread operator incorrectly, just kindly point out anything you may see. My lambda function is below: </p>
  
  <pre><code>const data = await documentClient.scan(params).promise();
      data.Items.map(item =&gt; {
        item = {
          ...item,
          control: control_id
        };
      });
  responseBody = JSON.stringify(data.Items);
  </code></pre>
  
  <p>UPDATE: I solved my issue above by doing the following: </p>
  
  <pre><code>const data = await documentClient.scan(params).promise();
      data.Items.forEach(item =&gt; {
        item.control = control_id;
      });
  responseBody = JSON.stringify(data);
  </code></pre>