title: aws api body mapping template
body: <p>I'm trying to format the output from my aws api but can't get one of the lists in the object to come through. I have the data loaded in dynamodb and my data looks like this:</p>
  
  <pre><code>[
    {
      "lastname": "person1",
      "firstname": "last2",
      "employeeid": 7,
      "hrs": [
        {
          "availhrs": "16",
          "ttlhrs": "12",
          "bllhrs": "14",
          "rto": "16",
          "ondeckhrs": "0",
          "nonbllhrs": "0",
          "employeeid": 78,
          "dtmonth": "2016-01-01T00:00:00.000Z",
          "clientid": 1,
          "clientId": 1,
          "employeeId": 78
        },
        {
          "availhrs": "16",
          "ttlhrs": "17",
          "bllhrs": "15",
          "rto": "26.5",
          "ondeckhrs": "0",
          "nonbllhrs": "0",
          "employeeid": 78,
          "dtmonth": "2016-02-01T00:00:00.000Z",
          "clientid": 1,
          "clientId": 1,
          "employeeId": 78
        }
      ]
    }
  ]
  </code></pre>
  
  <p>I try to format it like this:</p>
  
  <pre><code>#set($inputRoot = $input.path('$'))
  { 
      "employees": [
          #foreach($elem in $inputRoot.Items) 
          {
              "employeeid": "$elem.employeeid.N",
              "lastname": "$elem.lastname.S",
              "firstname": "$elem.firstname.S",
              "hrs": [
                  #foreach($elem in $inputRoot.Items.hrs)
                  {
                              "availhrs": "$elem.availhrs",
                              "ttlhrs": "$elem.ttlhrs",
                              "bllhrs": "$elem.bllhrs",
                              "rto": "$elem.rto",
                              "ondeckhrs": "$elem.ondeckhrs",
                              "nonbllhrs": "$elem.nonbllhrs",
                              "dtmonth": "$elem.dtmonth"
                  }#if($foreach.hasNext),#end
                  #end
              ]
          }#if($foreach.hasNext).#end
          #end
      ]
  }
  </code></pre>
  
  <p>but then my output looks like this:</p>
  
  <pre><code>{
    "employees": [
      {
        "employeeid": "7",
        "lastname": "last2",
        "firstname": "person1",
        "hrs": []
      }
    ]
  }
  </code></pre>
  
  <p>what am I doing wrong in the formating where my hrs part is not coming out?</p>