title: Return JSON with Lambda through API Gateway with mapping
body: <p>I am trying to figure out how to map a Response from Lambda in the API Gateway to different status codes and at the same time receive a JSON object from my Lambda-function.</p>
  
  <p>I have the following in Lambda:</p>
  
  <pre><code>context.done('Not Found:',jsonObject);
  </code></pre>
  
  <p>And in my API Gateway, in <strong>integration response</strong> I have a Lambda error regex on 403 saying <strong>Not Found:.*</strong>.
  This works, the method is returning a returning a 403.</p>
  
  <p>The problem is I can't seem to return the <strong>jsonObject</strong>.
  I have tried to create a application/json mapping template that looks like this (also under integration response):</p>
  
  <pre><code>{"error" : $input.json('$')}
  </code></pre>
  
  <p>But that only results in my response looking like this:</p>
  
  <pre><code>{"error" : {"errorMessage":"Not Found:"}}
  </code></pre>
  
  <p>Am I misunderstanding the mapping template?</p>