I\'ve generated some JSON and I\'m trying to pull it into an object in JavaScript. I keep getting errors. Here\'s what I have:
var data = \'{\"count\" : 1, \
JSON.stringify
JSON.stringify(`{
a:"a"
}`)
would convert the above string to
"{ \n a:\"a\"\n }"
as mentioned here
json stringify
This function adds double quotes at the beginning and end of the input string and escapes special JSON characters. In particular, a newline is replaced by the \n character, a tab is replaced by the \t character, a backslash is replaced by two backslashes \, and a backslash is placed before each quotation mark.