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>