["Первый", "Второй"];
{
"Первый":
0: {id: 8, branch: "Административные службы"}
"Второй":
0: {id: 1, branch: "Администрация"}
1: {id: 2, branch: "Администрация"}
}
document.querySelector('#output').innerHTML = arr.map(n => {
const columns = Object.keys(obj[n][0]);
return `
<h1>${n}</h1>
<table>
<thead>
<tr>${columns.map(n => `
<th>${n}</th>`).join('')}
</tr>
</thead>
<tbody>${obj[n].map(row => `
<tr>${columns.map(col => `
<td>${row[col]}</td>`).join('')}
</tr>`).join('')}
</tbody>
</table>`;
}).join('');