Используя ES6 , вы можете легко сделать одну строковую функцию, чтобы помочь вам сгладить вложенный массив с помощью свойства items
через Array.reduce :
var tickets = [{ "ticketId": 67973802, "account": null, "items": [{ "id": 117052912, "billingItemId": 36164304123, }, { "id": 11705232, "billingItemId": 361643044, }] }, { "ticketId": 67973802, "account": null, "items": [{ "id": 117052945, "billingItemId": 361643046, }, { "id": 117052953, "billingItemId": 361643049, }] } ];
const pullBy = (arr, prop) => arr.reduce((r,c) => [...r[prop], ...c[prop]])
console.log(pullBy(tickets, 'items'))
При использовании lodash
лучшим вариантом будет flatMap :
var tickets = [{ "ticketId": 67973802, "account": null, "items": [{ "id": 117052912, "billingItemId": 36164304123, }, { "id": 11705232, "billingItemId": 361643044, }] }, { "ticketId": 67973802, "account": null, "items": [{ "id": 117052945, "billingItemId": 361643046, }, { "id": 117052953, "billingItemId": 361643049, }] } ];
const result = _.flatMap(tickets, 'items')
console.log(result)
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.min.js"></script>