Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token } in JSON at position 823 #202

Closed
markgoho-EDT opened this issue Dec 21, 2017 · 8 comments
Closed

Unexpected token } in JSON at position 823 #202

markgoho-EDT opened this issue Dec 21, 2017 · 8 comments
Labels

Comments

@markgoho-EDT
Copy link

Search path: c:/Users/Nella/Documents/EDT/app-copa/src/app
Config file name: c:/Users/Nella/Documents/EDT/app-copa/tsconfig.json
SERVER ERROR: Unexpected token } in JSON at position 823
SyntaxError: Unexpected token } in JSON at position 823
    at JSON.parse (<anonymous>)
    at parseAndReEmitConfigJSONFile (C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\editorServices.js:257:33)
    at ProjectService.configFileToProjectOptions (C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\editorServices.js:1598:18)
    at ProjectService.openConfigFile (C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\editorServices.js:1620:42)
    at ProjectService.openOrUpdateConfiguredProjectForFile (C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\editorServices.js:1486:41)
    at ProjectService.openClientFile (C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\editorServices.js:1404:23)
    at C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\documents.js:135:47
    at TextDocuments.logErrors (C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\documents.js:235:13)
    at C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\documents.js:131:74
    at handleNotification (C:\Users\Nella\.vscode-insiders\extensions\Angular.ng-template-0.1.7\server\node_modules\vscode-jsonrpc\lib\main.js:353:21)
[Error - 10:05:39 PM] Notification handler 'textDocument/didOpen' failed with message: Unexpected token } in JSON at position 823
@chuckjaz chuckjaz self-assigned this Dec 30, 2017
@chuckjaz chuckjaz added the bug label Dec 30, 2017
@smasala
Copy link

smasala commented Jan 10, 2018

+1

[Error - 23:16:59] Notification handler 'textDocument/didOpen' failed with message: Unexpected token } in JSON at position 515

@tkoenig89
Copy link

tkoenig89 commented Jan 18, 2018

Having the same issue with a different error position:

[Error - 11:28:36] Notification handler 'textDocument/didOpen' failed with message: Unexpected token } in JSON at position 534

Edit
I'm using following versions:
Angular: 5.2.0
Typescript: 2.5.3
VSCode: 1.19.2

@tkoenig89
Copy link

tkoenig89 commented Jan 19, 2018

I guess, i managed to find the root cause. It's not a bug in the plugin or the language service! It's an issue with the tsconfig.json beeing not formated correctly.

My tsconfig.json looked like this:

"angularCompilerOptions": { 
      "fullTemplateTypeCheck": true , //<-------- This comma did cause the issue
}

After removing the comma, the plugin worked well.

@markgoho-EDT
Copy link
Author

@tkoenig89 respectfully, as the creator of this issue, please allow for others to test this solution before suggesting that they close it because you found something that worked for you 👍

@tkoenig89
Copy link

@markgoho-EDT i guess you are right, i might have been a little too quick about this. Might be because i was bothered by the issue, and too happy when i finally managed to find a solution :)

@markgoho-EDT
Copy link
Author

markgoho-EDT commented Jan 19, 2018

Update: we also had an extraneous comma at the end of a line in our tsconfig.json

it was here:

    ...
    "pretty": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "noUnusedParameters": false,
  },

after noUnusedParamters.

@chuckjaz hopefully this helps. I won't close this bug because this should probably solved by a different method of error handling rather than a user removing a comma.

@rohitkrishna094
Copy link

I too had the same problem. I ran jslint on all json files in my angular project. And it turns out that there was a small comma in angular.json file that caused the issue. Removing that fixed everything. Leaving it here in case someone needs it. Found the solution on stackoverflow question and this thread.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants