Display JSON data in the table
I am having an issue to access my JSON data. It is inside the array of objects of objects. How can I do that?
I am using the map function to display it, but only the name and avatar. It is nested.
JSON data
[
{
"id": "1",
"person": {
"name": "Prerna Jha",
"avatar": "profile.jpg"
},
"city": "Mumbai",
"email": "prernajha@gmail.com",
"joiningDate": "12/02/2018",
"role": "UI Designer"
},
]
{data.map((curElem) => {
const { id, name, avatar, city, email, joiningDate, role } = curElem;
return (
<tbody key={id}>
<tr>
<td>{name}</td>
<td>{avatar}</td>
<td>{city}</td>
<td>{email}</td>
<td>{joiningDate}</td>
<td>{role}</td>
</tr>
</tbody>
);
})}
I have got few data and nested objects, but I am not getting it.