issue with parsing JSON string

Posted by bgosalci on Stack Overflow See other posts from Stack Overflow or by bgosalci
Published on 2009-05-11T15:07:43Z Indexed on 2010/05/10 3:08 UTC
Read the original article Hit count: 314

Filed under:
|

I have this object which I use as a list of objects:

var objList = new Object();

This is then serialized using JSON serialize. If there are no object added or all objects have been removed from the list and the blank objList is serialized, parsing the objList using JSON parser in IE, it will occasionally fail to evaluate the objList as a JavaScript object.

This causes the Object doesn't support this property or method error when tying to add an object to the objList:

objList['idx']=objData;

Does anyone know why does IE occasionally fail to evaluate objList:{} to an object and has someone else come across this issue.

The actual JSON string when the objList is '{}'

The objList is initialised:

objList = g_objList.parseJSON();

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about JSON