JSON.parse抛出了意外的令牌e

时间:2015-12-03 06:14:27

标签: jquery json filereader

我正在尝试使用FileReader从文件中读取JSON对象。 此json文件包含以下内容:

SciPy

这是我写的代码:

{"markers": [
        {
            "point":new GLatLng(40.266044,-74.718479), 
            "homeTeam":"Lawrence Library",
            "awayTeam":"LUGip",
            "markerImage":"images/red.png",
            "information": "Linux users group meets second Wednesday of each month.",
            "fixture":"Wednesday 7pm",
            "capacity":"",
            "previousScore":""
        },
        {
            "point":new GLatLng(40.211600,-74.695702),
            "homeTeam":"Hamilton Library",
            "awayTeam":"LUGip HW SIG",
            "markerImage":"images/white.png",
            "information": "Linux users can meet the first Tuesday of the month to work out harward and configuration issues.",
            "fixture":"Tuesday 7pm",
            "capacity":"",
            "tv":""
        },
        {
            "point":new GLatLng(40.294535,-74.682012),
            "homeTeam":"Applebees",
            "awayTeam":"After LUPip Mtg Spot",
            "markerImage":"images/newcastle.png",
            "information": "Some of us go there after the main LUGip meeting, drink brews, and talk.",
            "fixture":"Wednesday whenever",
            "capacity":"2 to 4 pints",
            "tv":""
        },
] }

由console.log()打印的jsonObject:

  

{“markers”:[{“point”:new GLatLng(40.266044,-74.718479),“homeTeam”:“Lawrence Library”,“awayTeam”:“LUGip”,“markerImage”:“images / red.png “,”“信息”:“Linux用户组每个月的第二个星期三。”,“灯具”:“星期三晚上7点”,“容量”:“”,“previousScore”:“”},{“点”:新GLatLng (40.211600,-74.695702),“homeTeam”:“Hamilton Library”,“awayTeam”:“LUGip HW SIG”,“markerImage”:“images / white.png”,“信息”:“Linux用户可以在第一个星期二见面计算出哈佛和配置问题。“,”fixture“:”星期二晚上7点“,”容量“:”“,”电视“:”“},{”点“:新GLatLng(40.294535,-74.682012) ,“homeTeam”:“Applebees”,“awayTeam”:“LUPip Mtg Spot之后”,“markerImage”:“images / newcastle.png”,“信息”:“我们有些人在主要的LUGip会议之后去那里,喝啤酒,并且说话。“,”夹具“:”星期三每当“,”容量“:”2到4品脱“,”电视“:”“},]}

'未捕获的SyntaxError:调用JSONView()时抛出意外的标记e'。

有人可以指出代码有什么问题吗?谢谢。

1 个答案:

答案 0 :(得分:0)

对于初学者来说,这不是有效的JSON。这些位:new GLatLng(40.266044,-74.718479)

...不能是JavaScript类构造函数;将它们更改为the JSON spec中定义的类型之一。

相关问题