I need to convert the array objects to an array of arrays with its object key of each item of objects as below
var inputData = [{"0":420,"10":373,"20":340,"30":313,"40":293,"50":273,"60":259,"70":243},
{"0":620,"10":550,"20":500,"30":460,"40":430,"50":400,"60":378,"70":355},
{"0":820,"10":727,"20":660,"30":607,"40":567,"50":527,"60":497,"70":467}]
The above input data of the object has a set of values with keys from which the output array should be like below.
var outputData = [[
[0,420],[10,373],[20,340],[30,313],[40,293],[50,273],[60,259],[70,243]
],
[
[0,620],[10,550],[20,500],[30,460],[40,430],[50,400],[60,378],[70,355]
],
[
[0,820],[10,727],[20,660],[30,607],[40,567],[50,527],[60,497],[70,467]
]]
for which I had written a for each loop as below code which is returning an entire value in a single array
var inputData = [{"0":420,"10":373,"20":340,"30":313,"40":293,"50":273,"60":259,"70":243}, {"0":620,"10":550,"20":500,"30":460,"40":430,"50":400,"60":378,"70":355}, {"0":820,"10":727,"20":660,"30":607,"40":567,"50":527,"60":497,"70":467}];
var sp = Object.keys(inputData[0])
let outputData = []
inputData.forEach(i => {
sp.forEach(element => {
outputData.push([parseInt(element), i[element]])
});
})
console.log(outputData)