parseJSON giving error Microsoft JScript compilation error: Syntax error

If you are getting the exception message Microsoft JScript compilation error: Syntax error
for $.parseJSON method.

In order to rectify the issue follow the steps below,

  1. Probably this issue is caused by the jSon string you are trying to parse
     var tmpJSon = '[{"SectionId":1132,"ModifiedBy":0,"SectionName":"

    As you see above jSon string contains "

  2. Before calling $.parseJSON or jQuery.parseJSON function of jQuery remove the encoding, i.e. replace " by ”
    var tmpJSon = tmpJSon .replace(/"/ig, '"');
    var jSonObject = $.parseJSON(tmpJSon );
  3. Most probably this time you may not the exception i.e. Microsoft JScript compilation error: Syntax error