I'm struggling with a common error - the link in my browser opens fine with JSON structure, but I keep getting an error when using weatherRequest.json()
:
Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
.
Can someone help me figure out where the problem lies?
let fetchWeather = async () => {
const weatherRequest = await fetch(`api.openweathermap.org/data/2.5/forecast?q=München,DE&appid=my_key`);
const weatherStore = await weatherRequest.json();
console.log('weatherStore', weatherStore);
}
fetchWeather();