如何在 JavaScript 中将我的输入转换为以下提到的格式

问题描述

我有一个包含 100 个对象的数组,其中每个对象都具有以下格式 (作者可重复)

author: "Sarahedo"
id: "-MXSJUeVeqWXDQTpL5uA"
optionOne: {text: "have horrible short term memory",Votes: ["john doe]}
optionTwo: {text: "have horrible long term memory",Votes: ["Sarahendo","lisa"]}
timestamp: 1617547098175

// i have around 100 such objects in a array

我想将其转换为对象列表,其中单个用户只有一个包含其所有详细信息的条目,请参阅下面的格式

[{},{},{}]
each object:
          {"johndoe": 
                     {"asked": (here it come the number of questions johndoe is author of)}
                     {"Voted": (here it come the number of questions johndoe has Voted for)}
          }

投票包括是否在选项一或二中。

我怎样才能做到这一点?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)