尝试从服务器下载文件时,我使用$ http服务,如下所示:
$http({url: url, method: "GET", withCredentials: true});
对于某些未知原因仅 json文件从服务器获取时导致异常:
SyntaxError: Unexpected token ] in JSON at position 1362
at Object.parse (native)
at tc (https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:14:245)
at bc (https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:77:7)
at https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:77:369
at q (https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:7:322)
at dd (https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:77:351)
at c (https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:78:495)
at https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:112:182
at m.$eval (https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:126:250)
at m.$digest (https://sharon-staging.comilion.com/app/bower_components/angular/angular.min.js:123:365)
json文件有效,我在问题中附上了他。
如果它是一个文本文件,甚至是我在json上面添加注释的同一个文件,也没有例外。
如果有人知道为什么我会收到这个错误,那真的会有所帮助:)
由于
无法正常工作:
{
"users": [
{
"email": "D_user1@e2e.com",
"nickName": "D_user1e2e"
}
],
"groups": [
{
"name": "D_BETWEEN_INSTANCES",
"description": "GROUP OF USERS FROM ALL INSTANCES",
"members": [
"user6@e2e.com",
"A_user6@e2e.com",
"B_user6@e2e.com",
"D_user1@e2e.com"
]
},
]
}
工作文件:
tests
{
"users": [
{
"email": "D_user1@e2e.com",
"nickName": "D_user1e2e"
}
],
"groups": [
{
"name": "D_BETWEEN_INSTANCES",
"description": "GROUP OF USERS FROM ALL INSTANCES",
"members": [
"user6@e2e.com",
"A_user6@e2e.com",
"B_user6@e2e.com",
"D_user1@e2e.com"
]
},
]
}
答案 0 :(得分:1)
从此处删除,
符号 -
"D_user1@e2e.com"
]
},
像这样 -
"D_user1@e2e.com"
]
}