title: AWS API Gateway Mapping Template JSON
body: <p>I've got a API stage that's <strong>NOT</strong> using "Lambda Proxy integration" which has a Lambda function passing an error.</p>
  
  <p>In the mapping template I have this:</p>
  
  <pre><code>$input.path("$.errorMessage")
  </code></pre>
  
  <p>Which results in the output of this:</p>
  
  <pre><code>{
      "headers": {
          "apiVersion": "20190218.1",
          "isTesting": true
      },
      "body": {
          "statusCode": 503,
          "status": "Service Unavailable",
          "title": "One or more of our data providers are currently offline for scheduled maintenance"
       }
  }
  </code></pre>
  
  <p>The header values are mapped to template headers and pull through correctly, however I need the body to transform to this:</p>
  
  <pre><code>{
     "statusCode": 503,
     "status": "Service Unavailable",
     "title": "One or more of our data providers are currently offline for scheduled maintenance"
  }
  </code></pre>
  
  <p>Whatever I have tried, body always returns as a blank string, an empty body, or an invalid JSON.</p>
  
  <p>This is the closest I've got but it returns an invalid JSON:<br>
  <code>$util.parseJson($input.path("$.errorMessage")).body</code></p>
  
  <p>Result (comes back with no quotes):</p>
  
  <pre><code>{statusCode=503, status=Service Unavailable, title=One or more of our data providers are currently offline for scheduled maintenance}
  </code></pre>
  
  <p>Is it possible to do what I'm after? I can't find a reverse for $util.parseJson (i.e, stringify).</p>
  
  <p>Thanks!</p>