title: Adding Nested Key To JSON Using Javascript
body: <p>I'm just starting to learn Javascript so my apologies if this is a stupid question.</p>
  
  <p>Basically my issue is this:</p>
  
  <p>Via an external form that I cannot change, I am receiving the following data.</p>
  
  <pre><code>var data = "{\"status\": \"created\", \"name\": \"mike\", \"roleName\": \"Signer\", \"emailSubject\": \"test\", \"email\": \"hellO@yahoo.com\", \"templateId\": \"0171502E-38F7-43A7-BA09-6FC1FDAB09C2\" }"
  </code></pre>
  
  <p>Before I can send the data via API, the documentation requires that I add an additional nested key (templateRoles) to wrap rolename, emailsubject, and email into a new array. The final results is suppose to look like this.</p>
  
  <pre><code>var data = "{\"status\": \"created\", \"name\": \"mike\", \"templateRoles\": [{ \"roleName\": \"Signer\", \"emailSubject\": \"test\", \"email\": \"hellO@yahoo.com\"}], \"templateId\": \"0171502E-38F7-43A7-BA09-6FC1FDAB09C2\"}"
  </code></pre>
  
  <p>For the life of me I cannot figure out how to do this. I've tried using splice and replace but either I am doing it wrong or that isn't the right approach. Any suggestions or pointers in the right direction would be greatly appreciated.</p>
  
  <p>Thanks in advance. </p>