哔哔one
您可以将值分组到一个数组中const arr = [{ "0156": { "test": "hi", "test2": "abc" } }, { "0156": { "test": "hi2", "test2": "abc1" }, "0157": { "test": "y1" } }, { "0156": { "test": "hi3" }, "0158": { "test": "ti2" } }, { "0156": { "test": "hi4" }, "0157": { "test": "y" } }, { "0158": { "test": "ti" } }]const res = arr.reduce(function(acc, curr) { for (let p in curr) { acc[p] = acc[p] || curr[p] for (let p1 in curr[p]) acc[p][p1] = acc[p][p1] != curr[p][p1] ? [].concat(acc[p][p1], curr[p][p1]) : curr[p][p1] } return acc}, {})console.log(res)