I am trying to extract JSON data from an api, but running into issues. When I console.log the data, it shows...
I am trying to access name from the returned json object.I tried to log json.(whatever) from the object and is shows undefined.
const fetchData = async () => { const response = await fetch('http://swapi.dev/api/vehicles/30/') const json = response.json(); console.log(json); }
fetchData();
https://stackoverflow.com/questions/66501965/javascript-need-help-accessing-api-json-data March 06, 2021 at 11:05AM
没有评论:
发表评论