I am have AWS Lambda function where I am sending a string as my final response
let abc= `"phone_exist":"0","calls":"0","lastaction":"0"`
callback(null,abc);
Output: "\"phone_exist\":\"0\",\"calls\":\"0\",\"lastaction\":\"0\""
here I am unable to understand why "\" has been appended in my string.
- Can anyone explain me the reason behind this?
Is their a way using which '\' can be removed so I can get in following form
"phone_exist"="1","calls"="2","lastaction"="3"
\is an escape character used to escape". A simple way to get rid of\is to add{}at the beginning and the and of the string and useJSON.parse(output). This will convert the result into an object and you can use it directly usingcalls = output.calls