Skip to content Skip to sidebar Skip to footer

Why Doesn't My Attempt To Escape Quotation Marks In Json Work?

I am parsing a JSON-string with the JQuery.parseJSON function, as I have done lot's of times in my code. On this particular case, though, I get: Uncaught SyntaxError: Unexpected to

Solution 1:

You probably need to escape the backslash in your string, if it is hardcoded, so that the final string that gets parsed has a single backslash followed by a double quote. Otherwise, the browser thinks you are trying to escape a double quote in your string, which does nothing.

So change your string to:

...\\"R...

Post a Comment for "Why Doesn't My Attempt To Escape Quotation Marks In Json Work?"