var myList = document.querySelector('ul'); fetch('snowreport.json') .then(function(response) { if (!response.ok) { throw new Error("HTTP error, status = " + response.status); } return response.json(); }) .then(function(json) { for(var i = 0; i < json.current.length; i++) { var listItem = document.createElement('li'); listItem.innerHTML = '<strong>' + json.current.temp + '</strong>'; myList.appendChild(listItem); } }) .catch(function(error) { var p = document.createElement('p'); p.appendChild( document.createTextNode('Error: ' + error.message) ); document.body.insertBefore(p, myList); });