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

513
Views
GET - 404 (No encontrado) Error al obtener el archivo json

Aquí está el fragmento de mi archivo fetch json. Siempre hay un error cuando intento obtener los datos del archivo json.

 const onSearchSubmit = (term) => { console.log(term); fetch('./JSONDATA.json', { method: 'get', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, }) .then(function (response) { return response.json(); }) .then(function (data) { setFruits(data); console.log(data.term); }) .catch((error) => { console.log(error + "json file"); }); };

IMAGEN DEL FRAGUMENTO ORIGINAL

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El error no está relacionado con React ni con fetch() . Dice que su servidor ha respondido con 404 Not Found . Esto significa que su archivo no está presente/no se puede acceder a él.

Verifique con el navegador (o curl ) que la URL http://localhost:3000/JSONDATA.json existe y es accesible

Nota al margen

'Content-Type': 'application/json' , este es el encabezado del tipo de body de la solicitud, pero no tiene cuerpo.

about 4 years ago · Juan Pablo Isaza Report
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!