I have JSON Data from an API which contains users at different locations. I want to map it to an HTML table that looks like the one shared below.
JSON DATA:
{
"data": [{
"location": "Location 1",
"Address": "location 1, Address",
"users": [{
"name": "Location 1 User",
"state": "Active"
}]
}, {
"location": "Location 2",
"Address": "Location 2, Address",
"users": [{
"name": "Location 2 User",
"state": "Active"
},
{
"name": "Location 2 User",
"state": "Inactive"
}
]
}]
}
If you notice in the third column, both users of the second location are added inside one td element and are listed in one cell. I want to transform my JSON to this sort of table with RAW Javascript.
I have tried different ways but no luck so any help on this would be appreciated!
Thank you!
