hello just wondering how do I access the temperature? do I have to stringify or just use the data? Im very new to programming and don't know how to access stringifyed object
code below
fetch(
"https://api.openweathermap.org/data/2.5/weather?q=Zushi,japan&APPID=undefined&units=metric"
)
.then((response) => response.json())
.then((data) => {
console.log(data);
// let myJSON = JSON.stringify(data);
document.getElementById("temp").innerHTML = data[0];
});
this is the object im trying to access and append to html page?
object = {coord: {…}, weather: Array(1), base: 'stations', main: {…}, visibility: 10000, …}
base: "stations"
clouds: {all: 28}
cod: 200
coord: {xxxxxxx}
dt: 1656072014
id: 1847968
main: {temp: 26.87, feels_like: 29.9, temp_min: 26.38, temp_max: 28.8, pressure: 1006, …}
name: ""
sys: {type: 2, id: 20510, country: 'JP', sunrise: 1656012469, sunset: 1656064800}
timezone: 32400
visibility: 10000
weather: [{…}]
wind: {speed: 12.05, deg: 217, gust: 17.58}
[[Prototype]]: Object