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

225
Views
¿Cómo extraigo mis datos del archivo json para poder ponerlo en html interno?

Estoy tratando de extraer mis datos del archivo JSON. Incluso usé .map() para mapear los datos, pero termina mostrando el error de que result.map() no es una función definida. ¿Cómo muestro datos extraídos?

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>JSON Test</title> </head> <body> <div id="myData"></div> <!-- Here a loader is created which loads till response comes --> <div class="d-flex justify-content-center"> <div class="spinner-border" role="status" id="loading"> <span class="sr-only">Loading...</span> </div> </div> <h1>Registered Employees</h1> <!-- table for showing data --> <table id="employees"></table> </body> <script src="api1-2.js"></script>> </html>

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

0

Reemplace response.txt() con response.json() para analizar la respuesta de API al objeto json. con response.text() su resultado está en una cadena, por lo que no tiene un método de mapa y, por lo tanto, el error undefined .

 fetch("https://v1.nocodeapi.com/OPENSOURCE12/instagram/gflSSOQjdOHsVnhT", requestOptions) .then(response => response.json()) // 👈 modified .then(result => {console.log(result)}) .catch(error => console.log('error', error));
about 4 years ago · Juan Pablo Isaza Report

0

Debe usar response.json() en lugar de response.text() .

Tanto response.json() como response.text() devuelven una promesa, pero response.json() resuelve esa promesa en un objeto de JavaScript, mientras que response.text() resuelve esa promesa en una cadena.

Referencias:

  • Respuesta.json()
  • Respuesta.tex()
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!