title: Sort/sequence AWS API gateway output
body: <p>tl;dr looking to sort API output from AWS API gateway</p>
  
  <p>I have a dynamoDB table 'NP' with key 'id' and GSI 'atype-index'. There is no sort key. </p>
  
  <p>Also, I have API gateway mapping template </p>
  
  <pre><code>{
      "TableName": "NP",
      "IndexName": "atype-index",
      "KeyConditionExpression": "atype = :v1",
      "ExpressionAttributeValues": {
          ":v1": {
              "S": "$input.params('atype')"
          }
      }
  }
  </code></pre>
  
  <p>The mapping template will extract all values in the table with GSI key matching the specified string. However, the values are extracted in no particular order, for example, the API could be:</p>
  
  <pre><code>{
    "Count": 3,
    "Items": [
      {
        "apiUrl": {
          "S": “ee”
        },
        "webTitle": {
          "S": “dd”
        },
        "atype": {
          "S": “type”
        },
        "id": {
          "S": "1a"
         }
       },
      {
        "apiUrl": {
          "S": “dd”
        },
        "webTitle": {
          "S": “cc”
        },
        "atype": {
          "S": "atype"
        },
        "id": {
          "S": “3a”
         }
       },
      {
        "apiUrl": {
          "S": “cc”
        },
        "webTitle": {
          "S": “bb”
        },
        "atype": {
          "S": "atype"
        },
        "id": {
          "S": “2a”
         }
       }
    ],
    "ScannedCount": 3
  }
  </code></pre>
  
  <p>How do I sort the above output by the key "apiURL" for example?</p>