How can I convert the following data structure:
var data = [ [ { time: 1, speed : 20 } ] ];
to
var data = [ { time: 1, speed: 54 } ];
I just want to remove the array.
As the data is an array, you just want to select the first element of the outer array
so the solution would be
var data = [[{time:1,speed:20}]]; // Or whatever the data is
data = data[0];
Or if you're accessing the data via another object
var data = yourObject[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With