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

215
Visualizações
Is it possible to display json response on a web page?

So i made a async/await request and wanted to output the response in json format: I first tried to use alert to alert the response, it displayed the response in an alert box. Then i tried logging it to the console, and it did the same thing in the console. Then i tried displaying it to the webpage using the HTML DOM and interesting things happened. Instead of displaying the response to the webpage, it displayed [object Object].

Now i am curious: Can you actually display json response to the webpage?

Btw this is how my request looks like:

async function syncf() {
  try {
    const response = await fetch("https://reqres.in/api/users/2")
    if (response.ok) {
      const jsonResponse = await response.json()
      document.getElementById("response").innerHTML = jsonResponse
    }
  } catch(error) {
    console.log(error)
  }
}

syncf()
about 4 years ago · Juan Pablo Isaza
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