title: AWS Lambda XML to JSON using Node JS
body: <p>I am unable to get callback in JSON format when trying to convert XML to JSON in AWS Lambda and API gateway integration.</p>
  
  <p>Code :</p>
  
  <pre><code>enter code here
  
  exports.handler = (event, context, callback) =&gt; {
  var parseString = require('xml2js').parseString;
  var xml = "&lt;Name&gt;Sayyed Abbas&lt;/Name&gt;";
  parseString(xml, function (err, result) {
  var r = JSON.stringify(result)
  console.dir(r);
  callback(null,event.r);
  });
  };
  </code></pre>
  
  <p>The Output, I see in AWS is below.
  <a href="https://i.stack.imgur.com/K78iK.png" rel="nofollow noreferrer">enter image description here</a></p>