Here is the JSON link: https://www.cc.puv.fi/~asa/cgi-bin/fetchOrders.py
I am currently able to fetch objects, but I am experiencing difficulty in fetching arrays within the object as well.
Can someone guide me on how to also fetch the "products" arrays?
This is the javascript code I am using:
fetch('https://www.cc.puv.fi/~asa/cgi-bin/fetchOrders.py')
.then(res => res.text())
.then(text => displayData(text))
function displayData(data) {
console.log(data);
let orders = JSON.parse(data);
console.log(orders);
let table = "<table><tr><th>orderid</th><th>customerid</th><th>customer</th><th>invaddr</th><th>delivaddr</th><th>deliverydate</th><th>respsalesperson</th><th>comment</th><th>totalprice</th></tr>";
for(let i = 0; i < orders.length; i++) {
let order = orders[i];
console.log(order)
console.log(order.orderid);
table += '<tr><td>' + order.orderid + '</td><td>' + order.customerid + '</td><td>' + order.customer + '</td><td>' + order.invaddr + '</td><td>' + order.delivaddr + '</td><td>' + order.deliverydate + '</td><td>' + order.respsalesperson + '</td><td>' + order.comment + '</td><td>' + order.totalprice + '</td></tr>'
}
console.log(table);
document.getElementById('info').innerHTML = table+'</table>';
}