I'm trying to access some data inside a json object and i'm somewhat confused with the issue i'm facing. I have a json object like the following
{
"status": "success",
"data": {
"image": null,
"video": null,
"author": null,
"publisher": "Microlink Documentation",
"title": "React | Microlink Documentation",
"date": null,
"lang": "en",
"description": null,
"logo": "https://microlink.io/favicon.ico",
"url": "https://docs.microlink.io/sdk/getting-started/react/"
}
}
Here i have wrote the code so that console.log("meta",metaData.data); logs out
"image": null,
"video": null,
"author": null,
"publisher": "Microlink Documentation",
"title": "React | Microlink Documentation",
"date": null,
"lang": "en",
"description": null,
"logo": "https://microlink.io/favicon.ico",
"url": "https://docs.microlink.io/sdk/getting-started/react/"
But i want to take the title separately. So i've used console.log("meta",metaData.data.title); But i'm getting a error saying
Uncaught (in promise) TypeError: Cannot read property 'title' of undefined
What seems to be the problem here?
console.log("meta",metaData.data);should include the wordmetaat the begining of the output but I can't see it in the output you've provided. Are you sure that the second printout is from that call toconsole.log?