Currently, I am creating a blog completely from scratch with both front and backend components that communicate through an API I developed. Below is the JSON output of the API:
{
"status": true,
"posts": [
{
"id": 2,
"title": "a la zeub",
"description": "zebi",
"user_id": 1,
"created_at": "2022-12-08T12:16:58.000000Z",
"updated_at": "2022-12-08T12:16:58.000000Z"
},
{
"id": 4,
"title": "title2",
"description": "thing",
"user_id": 1,
"created_at": "2022-12-08T12:39:15.000000Z",
"updated_at": "2022-12-08T12:39:15.000000Z"
}
]
}
For my frontend, I utilize VueJS. When I need to display a specific value from the API response, I use the following syntax in the HTML section:
<p> {{ the name of the variable }} </p>
However, I am facing an issue where if I attempt to display posts.status
using this method, it correctly shows "true" in the p
tag. Yet, when trying something like posts.posts.id
or posts.posts['id']
, it does not work as expected. The p
tag remains empty in the source code. What should I input within the brackets to access the title?