JSFiddle - React, Tailwind, and code Playground
HTML
<table id="mytable">
<tr>
<td>Click button below to get output...</td>
</tr>
</table>
<button onclick="get_data()">Get Data</button>
CSS
#mytable tr > td {
font-family: Consolas,monospace;
font-size: 10pt;
}
JavaScript
async function get_data() {
let r = await fetch("https://cors-anywhere.herokuapp.com/http://dummy.restapiexample.com/api/v1/employees");
let body = await r.json();
let table = document.getElementById("mytable");
let tbody = document.createElement('tbody');
body.data.forEach(element => {
let r = tbody.insertRow(0);
let c = r.insertCell(0);
c.innerHTML = JSON.stringify(element);
})
console.log(table.tBodies[0]);
table.replaceChild(tbody, table.tBodies[0]);
}