i'm having some trouble:
I need put some value of a JSON list into a separate JSON object. I have a JSON list that contains rows of data and a JSON object. I would like to traverse se the list and map the rows into different objects in the JSON.
The first and the last elements are empty, then there are a finite number of names each followed by an indefinite number of couples "date", "vote" (see the pastebin for better understanding).
I then would like to collect all the votes under a certain name in the list to that object in JSON.
How i can do that in javascript? I should change the structure of the JSON?
That is the json:
{
"materie": [
{
"elettrotecnica_ed_elettronica": {
"voti": []
}
},
{
"lingua_e_letteratura_italiana": {
"voti": []
}
},
{
"lingua_inglese": {
"voti": []
}
},
{
"matematica_e_complementi_di_matematica": {
"voti": []
}
},
{
"scienze_motorie_e_sportive": {
"voti": []
}
},
{
"sistemi_automatici": {
"voti": []
}
},
{
"storia": {
"voti": []
}
},
{
"tecnologie_e_progettazione_di_sistemi_elettrici_ed_elettronici": {
"voti": []
}
}
]
}
And that is the array:
[ '',
'elettrotecnica ed elettronica',
'10',
'7½',
'8½',
'5',
'9',
'7',
'4',
'7-',
'7+',
'6',
'7½',
'lingua e letteratura italiana',
'6½',
'5+',
'6',
'7+',
'5',
'6½',
'lingua inglese',
'6+',
'7',
'7-',
'7½',
'7',
'7+',
'matematica e complementi di matematica',
'4½',
'9½',
'7',
'6½',
'9',
'7½',
'4',
'9',
'7½',
'7',
'8',
'8',
'scienze motorie e sportive',
'5',
'7',
'6',
'9',
'7',
'10',
'8',
'10',
'7',
'sistemi automatici',
'8',
'8½',
'10',
'10',
'8½',
'9½',
'10',
'10',
'10',
'9-',
'storia',
'4',
'6',
'5½',
'tecnologie e progettazione di sistemi elettrici ed elettronici',
's',
'7-',
'7',
'8',
'8-',
'7+',
'7½',
'6',
'6',
'8',
'6+',
'7-',
'7-',
'6',
'7',
'6',
'8½',
'' ]