<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<div id="parts"></div>
<script>
var data = {
"car": [
{
"id": 1,
"name": "BMW",
"year": 1999,
"parts": [1,2]
}],
"parts": [
{
"id": 1,
"name": "engine"
},
{
"id": 2,
"name": "window"
}
] };
var parts = data.parts.reduce(function(a, b) {
a[b.id] = b.name;
return a
}, {}),
arr = data.car.reduce(function(a, b) {
return a.concat(b.parts.map(function(a) {
return "Part " + a + " (" + parts[a] + ") - " + b.name
}))
}, []);
document.querySelector('#parts').insertAdjacentHTML("beforeEnd", "<div>" + arr.join("</div><div>") +"</div>");
</script>
</body>
</html>