{
"response": {
"type": "Заказ",
"id": "1245",
"items": [
{
"title": "Rear Window",
"director": "Alfred Hitchcock",
"year": 1954,
"photo": {
"1": "img1.jpg",
"2": "img2.jpg",
"3": "img3.jpg",
"4": "img4.jpg"
}
},
{
"title": "Rear Window",
"director": "Alfred Hitchcock",
"year": 1954,
"photo": {
"1": "img5.jpg",
"2": "img6.jpg",
"3": "img7.jpg",
"4": "img8.jpg"
}
}
]
}
}
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>Заголовок</th>
<th>Директор</th>
<th>Возвраст</th>
<th>Изображения.</th>
</tr>
</thead>
</table>
const { items } = JSON.parse(json).response;
const html = `
<tbody>${items.map(n => `
<tr>
<td>${n.title}</td>
<td>${n.director}</td>
<td>${n.year}</td>
<td>${Object.values(n.photo).map(m => `<img src="${m}">`).join('')}</td>
</tr>`).join('')}
</tbody>
`;
$('#example').append(html);
// или
document.querySelector('#example').insertAdjacentHTML('beforeend', html);
items.forEach(function(n) {
const tr = this.insertRow();
tr.insertCell().textContent = n.title;
tr.insertCell().textContent = n.director;
tr.insertCell().textContent = n.year;
tr.insertCell().append(...Object.values(n.photo).reduce((acc, m) => (
(acc[acc.length] = new Image).src = m,
acc
), []));
}, document.getElementById('example').createTBody());