Reformat object data to an array

Glad you got it figure out!

The reason formatDataAsArray() did not work is it takes an "object of arrays" in this form:

{
  id: [1,2,3,4],
  value: ['value1','value2','value3','value4']
}

and turns it into and "array of objects":

[ 
  {id:1, value:'value1'}, 
  {id:2, value:'value2'}, 
  {id:4, value:'value3'}, 
  {id:1, value:'value4'}
]

Yours did not quite follow either pattern as there was no array.

And of course formatDataAsObect() does the opposite conversion.

Hope that clears it up!

3 Likes