Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
how do i extract my data from json file so i can put it inner html?

i am trying to extract my data from JSON file i even used .map() to map out the data but it ends up showing error that result.map() is not a defined function. how do i show extract data

<!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 Respostas
Responde à pergunta

0

Replace response.txt() with response.json() to parse api response to json object. with response.text() your result is in string, so it does not have map method and hence the undefined error.

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 Relatório

0

You need to use response.json() instead of response.text().

response.json() and response.text() both return a Promise, but response.json() resolves that Promise to a JavaScript object while response.text() resolves that Promise to a String.

References:

  • Response.json()
  • Response.tex()
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda