Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
Fetching JSON in JS from Flask app gives JSON.parse error

I have a Python Flask app setup like this:

@app.route("/")
def getlist():
    data = jsonify({"test": True, "name": "User",
                    "teststring": "Hello, World!"})

    return data

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5050, debug=True)

Its a very simple one that returns a jsonified dictionary on the root (/) of domain. I hosted this site as you can see on localhost:5050. Now when I use JavaScript to fetch this JSON using the fetch api like this:

fetch("http://localhost:5050", {
    mode: "no-cors", // I added this due to some other error, called cross origin something
})
    .then((blob) => blob.json())
    .then((data) => console.log(data));

I get this error in this console:

Uncaught (in promise) SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

but the Network tab shows 200 OK

network status response

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!