How can I change key name but key its values?
For instance I have this json data that I have stored:
{ particles:
{ name: 'particles',
values: [ [Object], [Object], [Object], [Object], [Object] ] },
timestamps:
{ name: 'timestamps',
values: [ [Object], [Object], [Object], [Object], [Object] ] }
}
And I will loop this input and change the key:
{ particles: 'particle', timestamps: 'timestamp' }
Change particles
to particle
and timestamps
to timestamp
My attemp:
for (var property in data) {
stored[data[property]] = stored[property].values;
stored[property].name = data[property];
}
I only managed to change the name
's value inside the stored data but not the key name...
Any ideas?