I have an Object a like that:
a
const a = { user: { … groups: […] … } }
whereby there are a lot more properties in
Small fine tune of phillips first answer.
const object1 = { abc: { a: 1 } }; const object2 = { abc: { b: 2 } }; Object.assign(object1, { abc: { ...object1.abc, ...object2.abc } }); console.log(object1); // Object { abc: Object { a: 1, b: 2 } }