I've searched extensively on stack for a solution but couldn't find one, so I'm reaching out here for help:
Let's consider two arrays: one with "keys" and the other with "values"
For example:
keys = [CO2, Blood, General, AnotherKey, ... ]
values = [[2,5,4,6],[4,5,6],[1,3,34.5,43.4],[... [
The goal is to create specific Json structure like this:
[{
name: 'CO2',
data: [2,5,4,6]
}, {
name: 'Blood',
data: [4,5,6]
}, {
name: 'General',
data: [1,3,34.5,43.4]
}, {
...
},
}]
I attempted to manipulate strings and encode them as json, but it doesn't seem to be the right approach. I also tried using JSON.PARSE and JSON.stringify without success. If anyone knows the correct way to implement this, please share!
EDIT:
I realized that "name" and "data" are not strings but objects.