Answers for "SyntaxError: Unexpected end of JSON input"

11

SyntaxError: Unexpected end of JSON input while parsing near '...version":"2.0.6","devD' cli

npm cache clean --force
then run npm i
Posted by: Guest on March-22-2020
0

Unexpected end of JSON input while parsing near

Open Windows Powershell as admin
npm cache clean --force
solved the problem for me

Alternative : You can use yarn instead
npm install -g yarn
Posted by: Guest on December-07-2020
1

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
Posted by: Guest on March-22-2021
0

Unexpected end of JSON input

Your string is not compatible with json, try to find why there is no simple anwser
Posted by: Guest on October-25-2021

Code answers related to "SyntaxError: Unexpected end of JSON input"

Code answers related to "Javascript"

Browse Popular Code Answers by Language