In the following code newData print as follows
var newData =(JSON.parse(jobData));
console.log(newData);
currently it contains 5 values.it may varying
[{
mode: daily,
id: '71'
os: 'Win37'
}, {
mode: daily,
id: '45'
os: 'Win37-1'
}, {
mode: daily,
id: '37'
os: 'Win64'
}, {
mode: daily,
id: '86'
os: 'Win37'
},{
mode: daily,
id: '7'
os: 'Win64' ];
from the above json array i have to create array like this how it is possible?
ie create same os
'Win37'
with different id
.If duplicate os
present combine its ids
as follows
MynewArray = [{
mode: daily,
id: '71,86'
os: 'Win37'
}, {
mode: daily,
id: '45'
os: 'Win37-1'
}, {
mode: daily,
id: '37,7'
os: 'Win64'
}];
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…