I am trying to make a table from my json so that there are two columns 'ask' and 'bid' with the data from the arrays in each row. Right now its just making four rows with numbers 1 - ∞.
jsondata = {
"ask": [
350.5,
346,
341,
336,
331
],
"bid": [
346,
341,
336,
331,
326.5
]
}
for (var i in jsondata) {
var table = document.getElementById("apps");
var tr = document.createElement("tr");
var td = document.createElement("td");
for (var key in jsondata[i]) {
var txt = document.createTextNode(key);
td.appendChild(txt);
tr.appendChild(td);
}
table.appendChild(tr);
}
<div>
<table id="apps"></table>
</div>