title: how to configure body mapping template for AWS gateway API which take string as input
body: <p>I'm using AWS API gateway to create a post rest API. The rest API will add data in the dynamoDB table "Metadata" which has four columns. </p>
  
  <p>The input to the rest API is a string like "2 -164 4104 1.50", where each space-separated value belongs to the "Metadata" table columns value in sequence order.</p>
  
  <p>I'm unable to figure out how I can configure the Body Mapping Templates which can parse the input string and map it to table column in sequence order.</p>
  
  <p>The required output is shown in below image:
     <a href="https://i.stack.imgur.com/d2fpF.png" rel="nofollow noreferrer">https://i.stack.imgur.com/d2fpF.png</a></p>
  
  <p>I tried to split the string, splitting is fine. But I'm getting Response as 
    "__type": "com.amazon.coral.service#SerializationException"</p>
  
  <p>My mapping is content-type: application/json: </p>
  
  <pre><code> #set($rawAPIData=$inout.path('$'))
      #set($s=$rawAPIData.split(""))
      "TableName": "Metadata",
      "Item": {
      "id": {
              "S": "$s.get(0)"
      },
      "cap": {
              "S": "$s.get(1)"
      },
      "counter": {
              "S": "$s.get(2)"
      },
      "timer": {
              "S": "$s.get(3)"
      }
      }
  </code></pre>
  
  <p>Output logs:
  Endpoint request body after transformations:</p>
  
  <p>"TableName": "Metadata",
  "Item": {
      "id": {
          "S": "2"
  },
  "cap": {
          "S": "-164"
  },
  "counter": {
          "S": "4104"
  },
  "timer": {
          "S": "1.50"
  }
  }</p>
  
  <p>Endpoint response headers: {Server=Server, Connection=keep-alive, x-amzn-RequestId=J89RJ8GPC2D95GT0AP284PQSPBVV4KQNSO5AEMVJF66Q9ASUAAJG, x-amz-crc32=3948637019, Content-Length=60, Date=Sun, 26 Nov 2017 07:08:49 GMT, Content-Type=application/x-amz-json-1.0}
  Method response body after transformations: {"__type":"com.amazon.coral.service#SerializationException"}</p>
  
  <p>Seems the problem is with using application/json as content type and providing input as a string. How can I solve this use case?
  Help is much appreciated.</p>