When attempting to fetch a file from the server, I utilize the $http service in the following manner:
$http({url: url, method: "GET", withCredentials: true});
For some mysterious reason, an exception is only thrown when trying to retrieve JSON files from the server:
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; it is attached in the question.
If it's a plain text file or even the same file with a comment added above the JSON data, no exception occurs.
If anyone has any insights into why this error is happening, your input would be greatly appreciated :)
Thanks
Non-functional file:
{
"users": [
{
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b5f1eac0c6d0c784f5d087d09bd6dad8">[email protected]</a>",
"nickName": "D_user1e2e"
}
],
"groups": [
{
"name": "D_BETWEEN_INSTANCES",
"description": "GROUP OF USERS FROM ALL INSTANCES",
"members": [
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c696f796e2a5c792e79327f7371">[email protected]</a>",
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6928361c1a0c1b5f290c5b0c470a0604">[email protected]</a>",
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99dbc6eceafcebafd9fcabfcb7faf6f4">[email protected]</a>",
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6622391315031457260354034805090b">[email protected]</a>"
]
},
]
}
Functional file:
tests
{
"users": [
{
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="51150e2422342360113463347f323e3c">[email protected]</a>",
"nickName": "D_user1e2e"
}
],
"groups": [
{
"name": "D_BETWEEN_INSTANCES",
"description": "GROUP OF USERS FROM ALL INSTANCES",
"members": [
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8afff9eff8bccaefb8efa4e9e5e7">[email protected]</a>",
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5a4ba90968097d3a580d780cb868a88">[email protected]</a>",
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4d0f12383e283f7b0d287f28632e2220">[email protected]</a>",
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="581c072d2b3d2a69183d6a3d763b3735">[email protected]</a>"
]
},
]
}