I am puzzled by this. I read many posts on SO, but strangely I cannot find one solution for my situation.
I have the following very simple VALID json string. Note that it contains a double quote in attribute value.
{"text":"\"xxxxx"}
You can verify that it is a valid Json string at jsonlint
Now I hope to parse the above string with jQuery.parseJSON into an object the following way:
jQuery.parseJSON('{"text":"\"xxxxx"}');
I get error. Can someone let me know what I miss?
Thanks a lot!!!
Background
I am doing a web application. In the backend (Java+Spring), I use Google's Gson to parse a complex object into a Json string. This string is then passed to the fontend (Javascript) as a string. Now I need to convert the string back into a Json object. I cannot change this technical approach.
Update 1 The following is actual code generated as part of the page when the page is load (I can see it in View Source in Firefox)
<script>
var data='{"defaultLocale":"en","answers":[{"text":"\"xxxx"}.......
</script>
json.replace('"', '\\"').replace('\\', '\\\\');'{"text":"\"xxxxx"}', then to front-end it is delivered already broken:'{"text":""xxxxx"}'. It's can't be fixed at front-end side. show us code, where front-end receives the json, maybe we can debug it there to find out if it's true{"text":"\"xxxx"will be translated by JS engine as{"text":""xxxx". See, broken.data='{...}';becomesdata={...};