sheetal

sheetal

  • NA
  • 22
  • 20.3k

JSON error

Feb 8 2012 5:22 AM
Hi,

I am working on a maintenance project and they have used JSON in that project. I am getting the following error Microsoft JScript compilation error: Syntax error in the code snippet. I am new to JSON and after adding watch window I got to know the error and that is expected '(' .But I am not getting the correct syntax.

Following is the code snippet where I am getting the error:

parse : function(jsonString) {
        // filter out while statement
        var js = jsonString;
        if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
        if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
        return eval('('+js+')');
    }

Can anyone help me?
Thanks,
Sheetal

Answers (1)