How I can convert an array to an array of JavaScript objects.
For example I have an array as
data = [
["fruits","frozen","fresh","rotten"],
["apples",884,494,494],
["oranges",4848,494,4949],
["kiwi",848,33,33]
]
I want to convert it to a name value pair.
For example, first object in the resulting collection would be
{"fruits": "apple", "frozen": 884, "fresh": 494, "rotten": 494}
and so on for rest of the data.
["fruits":"apples","frozen":884,"fresh":494,"rotten":494],["fruits":"oranges","frozen":4848,"fresh":494,"rotten":4949]
or["fruits":["apples", "oranges"],"frozen":[884, 4848],"fresh":[494,494],"rotten":[494,4949]]
– Silage["fruits":"apple",
is not legal.[{"fruits":"apple"},
does – Gynandrous{
}
, arrays in[
]
– Nerissanerita