ijavascript
ijavascript copied to clipboard
JSON.stringify() wraps the output within ` (Grave Accent mark)
Issue: if the object contains string data with single quoted value in it, e.g. "Test 'data'"
, JSON.stringify(results)
returns result wrapped in ` (Grave Accent mark).
Actual result:
Expected result (without ` ): {"analyzer":"Test 'data'","details":{"range":{"start":"1","end":"2"},"description":"Hello"}}
Sample code:
function main() {
const results = {
analyzer: "Test 'data'",
details: {
range: {
start: "1",
end: "2"
},
description: "Hello"
}
};
return JSON.stringify(results);
}
main();