有一个原始数组格式如下[{Voltage:[{value:"-",timestamp:1551082567000,status:-2}{value:125,timestamp:1551082321000,status:1}{value:123,timestamp:1551082251000,status:1}]},{Ammeter:[{value:20,timestamp:1551082567000,status:-2}{value:15,timestamp:1551082321000,status:1}{value:13,timestamp:1551082251000,status:1}]}]Voltage和Ammeter名称都是动态改变的。请问一下如何才能使这个数组转换成以下格式?[{Voltage:'-',Ammeter:20,timestamp:1551082567000,Voltage_status:-2,Ammeter_status:-2},{Voltage:125,Ammeter:15,timestamp:1551082321000,Voltage_status:1,Ammeter_status:1},{Voltage:123,Ammeter:13,timestamp:1551082251000,Voltage_status:1,Ammeter_status:1}]谢谢大家不吝赐教!
繁星coding
海绵宝宝撒
相关分类