When trying to download a file from server i use $http service as following:
当尝试从服务器下载文件时,我使用$ http服务如下:
$http({url: url, method: "GET", withCredentials: true});
for some unkown reason only json files causing an exception when getting from server:
对于某些未知原因,只有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)
The json file is valid, i attached him in the question.
json文件有效,我在问题中附上了他。
if it's a text file, or even the same file that i added a comment above the json, there is no exception.
如果它是一个文本文件,甚至是我在json上面添加注释的同一个文件,也没有例外。
If anyone have an idea why do i get this error, it will really really help :)
如果有人知道为什么我会得到这个错误,它真的会有帮助:)
Thanks
not working file:
不工作的文件:
{
"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"
]
},
]
}
working file:
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"
]
},
]
}
1 个解决方案
#1
1
Remove the ,
sign from here-
从这里删除,签署 -
"D_user1@e2e.com"
]
},
like this-
"D_user1@e2e.com"
]
}
#1
1
Remove the ,
sign from here-
从这里删除,签署 -
"D_user1@e2e.com"
]
},
like this-
"D_user1@e2e.com"
]
}