1

Why is this JSON invalid in ie8 but not in firefox or chrome? On my callback I parse the results to remove some invalid characters using jquery parser.

myStringResults = myStringResults.replace("},]","}]");
myStringResults = myStringResults.replace(/'/g,'"');
var objDoc = $.parseJSON(myStringResults);

Message: Invalid JSON:

[{"id":"4796","parent":"4796","name":"Fname","revision":"1","date":"Mar 1, 2013 3:44:22 PM","author":"Silva, Jeffery M","filename":"C:\Users\jmsilva\Desktop\VOC pres.pdf","type":"0"},{"id":"4797","parent":"4797","name":"Fname","revision":"1","date":"Mar 1, 2013 3:50:46 PM","author":"Silva, Jeffery M","filename":"C:\Users\jmsilva\Desktop\testUpload.doc","type":"0"}]

1
  • I just tried that in the IE9 console in IE8 mode and it worked... Commented Mar 2, 2013 at 0:24

2 Answers 2

5

Your backslashes should be escaped as \\. While some browsers are willing to accept that \ followed by any character that doesn't make a special combination should be treated as a literal, it's unsafe to rely on that.

Sign up to request clarification or add additional context in comments.

Comments

2

In general you can use a tool like this to validate:

http://jsonformatter.curiousconcept.com/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.