Convert array of arrays into multidimensional array in Typescript -


i'm trying convert array of arrays requested http service. have following code below:

this array http service have number of arrays:

[object array] > [0] > make: "toshiba", model: "h2000" ..[n]

this needs converted multidimensional array this:

[{make:"toshiba"},{model:"h2000"}, {make:"hp"},{model:""}];

i have looked loop having no luck:

create method converts object array

function objtoarray(obj) {     return object.keys(obj).reduce(function(arr, key) {         arr.push({ [key] : obj[key] });         return arr;     }, []); } 

and run array through it:

var formattedarray = arr.map(x => objtoarray(x)); 

demo: https://jsfiddle.net/41d3p6zx/


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -