I am submitting an array that contains nested arrays from Angular to a server running Node.js. I would like to parse each field so I can include it in a confirmation email. I'm not sure how to get the key/values from the array and put them in the email body.
I've tried var email = req.body.email for the items one level deep and var cost = req.body.detail.cost for the nested items two levels deep, but those don't seem to work. 
Any suggestions?
Here's the Javascript:
router.post('/', function(req, res) {
  if (err) {
   res.status(402).send(err.message);
}
else {
  console.log(JSON.stringify(req.body, null, 2));
  var data = {
    from: storefront@example.com,
    to: email,
    subject: 'Your Order Confirmation',
    text: 'Thank you for your order. Below is your invoice:\n\n'+
          'Name: '+ firstName + ' ' + lastName +
          'Address: ' + address + ', ' + city + ', ' + state.code +'\n\n'+
          'Item    Description     Cost\n\n'+
          item +   description  +  cost 
// want to add the item, description, and cost for each item ordered
// . . . 
var mailgun = new Mailgun({apiKey: api_key, domain: domain});
  mailgun.messages().send(data, function (err, body) {
    if (err) {
      console.log('error');
    }
   else {
      console.log('email sent!');
    }
  })
}; 
This is what the array looks like this:
[
  [
    {
     "firstName": "John",
     "lastName": "Doe",
     "address": "555 Broadway",
     "city": "New York",
     "email": "john@example.com",
     "phone": "2125551212",
     "state": {
       "code": "NY",
       "state": "New York"
    },
     "timestamp": {
       "addedAt": 1443911047642
   },
    "zip": "10001",
    "$id": "-K-jnWa0IBiGCAInbaIr",
  }
],
[
  {
    "item": "Pants",
    "description": "Wranglers",
    "timestamp": {
      "addedAt": 1443911007264
   },
    "detail": {
      "cost": 60,
      "size": "36"
   },
    "$id": "-K-jnMj64LS-XMM18J-8",
},
{
   "item": "Pants",
   "description": "Levi's",
   "timestamp": {
     "addedAt": 1443911018026
  },
  "detail": {
    "cost": 80,
    "size": "33"
  },
   "$id": "-K-jnPMJDLJMKIH4rAUe",
  }
 ]
]
 
    