Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

208
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda