SyntaxError: JSON.parse:


Hello Folks,

Am getting this error:

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

When I try to fetch data from API Star from an app running in port 8000 and API star runs in 8080.

I am not using the JS provided in API star, but am using jQuery. I am stuck. Any help will be good.

Thank you.


The full traceback would be helpful here.

Whatever you’re using to consume the data is expecting and parsing data, but is actually being passed an empty string of bytes.

"end of data at line 1 column 1" - Ie. There’s no JSON there to parse.


I think its because of CORS, as it says so:

Failed to load http://localhost:8080/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

So how to allow it?


Am trying out this one:

will report if I have further issues.