<table id="print-table">
<tbody><tr class="main-head-table">
<th>ФИО</th>
<th>Должность</th>
<th>Внутренний номер</th>
</tr>
<tr>
<td colspan="7" style="text-align: center; font-weight: bold;" class="hide-tr">Администрация</td>
</tr><tr>
<td>wer</td>
<td>sdf</td>
<td>10001</td>
</tr><tr>
<td>sdf</td>
<td>sdf</td>
<td>10002</td>
</tr>
</tr></tbody></table>
function tableToJson() {
let result = [];
let table = document.getElementById("print-table").getElementsByTagName("tbody")[0];
let trs = table.getElementsByTagName("tr");
for (let i = 2; i < trs.length; i++) {
let tds = trs[i].getElementsByTagName("td");
let obj = {};
obj.name = tds[0].innerHTML;
obj.rank = tds[1].innerHTML;
obj.phone = tds[2].innerHTML;
result.push(obj);
}
return JSON.stringify(result);
}
var json_table = [];
$('#print-table tbody tr').slice(2).each(function() {
var tds = $(this).children('td');
json_table.push({
name: tds[0].text(),
rank: tds[1].text(),
phone: tds[2].text(),
});
});