2021年3月5日星期五

JavaScript: Need Help accessing API JSON data

I am trying to extract JSON data from an api, but running into issues. When I console.log the data, it shows...

enter image description here

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

没有评论:

发表评论