I'm trying to import a large JSON file but I'm getting this error:
Unexpected token , in JSON at position 197031914
how do i go to that position to fix it?
Thanks!
I'm trying to import a large JSON file but I'm getting this error:
Unexpected token , in JSON at position 197031914
how do i go to that position to fix it?
Thanks!
Besides the recommendations of using a json linter, this extension lets you navigate to a specific offset (position) within a file. You'd want to go to offset 197031914
.
Keep in mind that if the file has very long lines, VS Code will not display the entire line. You can try adjusting this limit by following these steps
Just use a JSON linter. There are plenty online, like this one. The linter will point out the specific errors in the syntax of your JSON file.
I know this is an older question but since its getting some views I want to mention how I ended up solving this issue.
Because I was processing huge files (gigabytes), it was not working with linters, so I ended up solving this issue by writing my script that takes a readable stream and find that position and then return the context (x number of charachters before and after position).
I still use it and I might get around to publish it on npm for others to use. (not sure if someone had already done a similar thing);
Looks like you have a one line file. There is an out-of-the-box command to jump to a line number in VS Code. But there is not for a jump to column. So, simply add this VSCode extension to be able to easily jump to a given column on line.
You can auto-fix by linting from the command line using eslint-plugin-json:
$ npm i eslint eslint-plugin-json
$ npx eslint --fix example.json
NOTE: You can get more info about the issue using npx eslint example.json
(before fixing).