i need to print a json data using aws lambda. this is my code
'use strict';
console.log('Loading function');
exports.handler = (event, context, callback) => {
var addon = require('./path/to/addon');
var sampleData=addon.getSampleData(userId);
console.log(sampleData); // it will print correct json data
//var sampleData="{ \"data\":{ \"key1\": \"1472722877992\", \"key2\": [ 814, 809] }}";
callback(null, sampleData);
};
i got output like this
"{ \"data\":{ \"key1\": \"1472722877992\", \"key2\": [ 814, 809] }}"
Bu i need to get output like this
"{ "data":{ "key1": "1472722877992", "key2": [ 814, 809] }}"
in this code, i created a npm library addon using c++ code. and getSampleData is a method inside c++ code. it will return a json formated string(not a json object) .in my node.js code, console log print correct json string.
But executing this lambda function returnd output with Slashes. How to solve this issue.