Good morning everyone, is there a method in Javascript to convert from
{
Control[0].Eseguito: "true"
Control[0].Id:"2"
Control[0].Nota:""
Control[1].Eseguito: "true"
Control[1].Id:"2"
Control[1].Nota:""
}
to javascript Array?
Control: Array(2)
0: {Id: '1', Eseguito: "true", Nota: ''}
1: {Id: '1', Eseguito: "true", Nota: ''}
EDIT
let myForm = document.getElementById('ControlForm');
var Controls = Object.fromEntries(new FormData(myForm).entries());
In mine ExecControl.cshtml i have situation like this, this is only a small snippet of codes
@{
int Indice = 0;
}
@for (int i = 0; i < Model.ListControls.Length; i++)
{
for (int j = 0; j < Model.ListControls[i].Controls.Length; j++)
{
...
<input type="text" style="width:100%;" name="Control[@Indice].Nota"/>
input type="text" style="width:100%;" name="Control[@Indice].Id" value="@ListControls[i].Controls.Id"/>
...
}
}
Controldetails from an HTML form?Controlsat the moment? Your first code block is unclear, isControl[0].Eseguitosupposed to be keys in an object? So you actually have:{"Control[0].Eseguito": "true", ... }