Add JSON object in Body of API Gateway to Kinesis proxy?
<p>I have configured API gateway as a Kinesis proxy as described in <a href="http://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-kinesis.html" rel="nofollow noreferrer">Amazon’s tutorial</a> for putting record into Kinesis stream. </p>

<p>The HTTP headers for integration request are:</p>

<ul>
<li><code>stream-name</code> is mapped to <code>method.request.header.stream-name</code></li>
<li><code>partition-key</code> is mapped to <code>method.request.header.partition-key</code></li>
<li><code>Content-Type</code> is mapped to <code>application/x-amz-json-1.1</code></li>
</ul>

<p>The body mapping template for content-type <code>application/json</code> looks like:</p>

<pre><code>{
    "StreamName": "$input.params('stream-name')",
    "PartitionKey": "$input.params('partition-key')",
    "Data": "$util.base64Encode({"rows": "$input.json('$')", "uuid": "$input.params('uuid')"})"
}
</code></pre>

<p>The data comes in as a JSON-request payload. We should add a <code>uuid</code> parameter as a JSON-object key into the data-payload for Kinesis, but the encoded data being sent to Kinesis isn’t a JSON object.</p>

<p>It is required to add a parameter <code>uuid</code> as a json-object key into the data-payload for kinesis. The problem I am facing is, that encoded data sent to kinesis is not a JSON object. </p>

<p>The data I expect to be sent to Kinesis should be a JSON object:</p>

<pre><code>{
 "rows": [{"id": 1, "name": "a"}, {"id": 2, "name": "b"}],
 "uuid": "0001"
}
</code></pre>

<p>But the actual data sent to Kinesis looks like:</p>

<pre><code>{
 rows=[{"id": 1, "name": "a"}, {"id": 2, "name": "b"}],
 uuid=0001
}
</code></pre>

<p>How can I send a JSON object from API gateway to Kinesis? I have been experimenting with <code>$util.parseJson</code> but couldn't find a solution for this scenario.</p>