const array1 = [{id:1, name:'doc1'}, {id:2, name:'doc2', {id: 3: "test"}}]; const array2 = [{id:1, name:'doc1'}, {id:3, name:'doc3'}, {id:4, name:'doc4'}]; const result = _.unionBy(array1, array2, 'id'); console.log(result);