Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

54
Vistas
Javascript parse JSON into table html

I' m trying to display datas from json into a table in html. SO far I have the following.

  • I need help to parse the data in dom

  • at the moment I can't display the datas properly. Specially the

    "1day": { "movement": 0.28, "price": null }

function readTextFile(file, callback) {
  var rawFile = new XMLHttpRequest();
  rawFile.overrideMimeType("application/json");
  rawFile.open("GET", file, true);
  rawFile.onreadystatechange = function() {
    if (rawFile.readyState === 4 && rawFile.status == "200") {
      callback(rawFile.responseText);
    }
  };
  rawFile.send(null);
}

//usage:
readTextFile("popular-feed.json", function(text) {
  var data = JSON.parse(text);
  //console.log(data);

  //SEE HERE

  var obj = JSON.parse(text, function(key, value) {
    console.log(key[1]);
    console.log(value);
  });
});
<div id="name"></div>
<div id="code"></div>
<div id="spread"></div>

7 months 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 empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.