I have the following structure:
var output = [{
"article": "BlahBlah",
"title": "Another blah"
}, {
"article": "BlahBlah",
"title": "Return of the blah"
}, {
"article": "BlahBlah2",
"title": "The blah strikes back"
}, {
"article": "BlahBlah2",
"title": "The blahfather"
}]
通过使用精简的lodash一行代码,我需要创建以下结构。
var newOutput = [{
"article": "BlahBlah",
"titles": ["Another blah", "Return of the blah"]
}, {
"article": "BlahBlah2",
"titles": ["The blah strikes back", "The blahfather"]
}]
非常感谢你一如既往的帮助。关于解决方案如何工作的说明是一个巨大的加分项。
titles
应该是数组吗? - Tushar'title:'
吗? - Nina Scholz