json.parse uncaught syntaxerror unexpected end of json input code example

Example 1: error Unexpected end of JSON input while parsing near '...

This is not a definitive answer but it looks like your global packages are corrupted in some way.

This bug may be caused by many different things. I suggest doing the following.

1 Install Node Version Manager (or NVM for Windows) and install Node version 10.16.1. This is enough for angular 9 and from my experience it is the most stable version for development. This should also change your NPM version so that may also help.
2 Uninstall global angular package npm uninstall -g @angular/cli
3 Force clear cache npm cache clean --force
4 Just to double check npm cache verify
5 You can also try clearing your %temp% and %roaming% AppData/npm-cache
6 install latest angular package npm install -g @angular/cli@<your-version>
7 if this error still occurs, consider using another shell

If this don't solve the problem try to manually locate the package.json file that is throwing an error and investigate.

Example 2: unexpected end of json input at

You are calling:

JSON.parse(scatterSeries)
But when you defined scatterSeries, you said:

var scatterSeries = []; 
When you try to parse it as JSON it is converted to a string (""), which is empty, so you reach the end of the string before having any of the possible content of a JSON text.

scatterSeries is not JSON. Do not try to parse it as JSON.

data is not JSON either (getJSON will parse it as JSON automatically).

ch is JSON … but shouldn't be. You should just create a plain object in the first place:

var ch = {
    "name": "graphe1",
    "items": data.results[1]
};

scatterSeries.push(ch);
In short, for what you are doing, you shouldn't have JSON.parse anywhere in your code. The only place it should be is in the jQuery library itself