JSON.parse在IE8中导致运行时错误

时间:2013-05-27 12:30:36

标签: json internet-explorer-8 internet-explorer-7

我遇到问题' 0x800a03ea - JavaScript运行时错误:语法错误'在IE8(及更早版本)中显示Google.map时。在其他浏览器和IE9及更高版本中,一切正常。虽然我已经阅读了很多关于Google.map API和IE8的问题,但我不认为这个问题是Google的API。调试时,这是错误发生的地方:

var rawObj = JSON.parse(serializedObject, MapObjectJSONParser);

serializedObject的内容是:

{"IsReadOnly":true,"Mode":1,"ForeignId":20,"Name":"Rådhuspladsen","Roadname":"Akseltorv","HouseNo":"1","ZipCode":"6000","City":"Kolding","Coordinates":["9.47321891784668;55.4903831481934"]} 
{"IsReadOnly":true,"Mode":1,"ForeignId":22,"Name":"Rådhustorvet","Roadname":"Rådhustorvet","ZipCode":"6400","City":"Sønderborg","Coordinates":["9.78874397277832;54.908821105957"]} 
{"IsReadOnly":true,"Mode":2,"ForeignId":12,"Name":"Amager fælled","ZipCode":"2300","City":"Amager Vest","Length":1247.88348835266,"Coordinates":["12.5822639465332;55.6549301147461","12.5779724121094;55.6439819335938"]}

MapObjectJSONParser引用以下函数:

function MapObjectJSONParser(key, value)
{
    if (key === 'Coordinates')
    {
        var coordinates = new Array();
        for (var i = 0; i < value.length; i++)
        {
            coorItems = value[i].split(";");
            coordinates.push(MapCoordinate.Create(parseFloat(coorItems[0]), parseFloat(coorItems[1])));
        }
        return coordinates;
    }
    return value;
};

任何人都有任何想法?

0 个答案:

没有答案