2

I have a JSON string as a result of an Ajax call and I want to parse the string, but my JSON string contains \u0030 or anything that starts with \u, and also those codes like &nbsp or &thinsp or any similar things that prevents json.parse from working. Is there a way to remove them or at least make json.parse understand those characters?

dda
  • 6,030
  • 2
  • 25
  • 34
  • 1
    JSON.parse should not be affected by those unless the string is wrongly delivered to JS. `c=new Option(); c.innerHTML = "blah   blah \u0222"; c.text;` will realize the chars, the reverse order will escape them. – dandavis Jan 08 '17 at 14:46
  • as @dandavis says, `JSON.parse` will work just fine with those characters - https://jsfiddle.net/pej5ded3/ - if you want to decode HTML entities see here - http://stackoverflow.com/questions/5796718/html-entity-decode – mikeapr4 Jan 10 '17 at 14:01

0 Answers0