I'm still a beginner in JavaScript and I need to create an object based on what the user types in the input fields.
Here are the input fields on my form:
After the user enters the values for column and value, this is how the data is being received:
[
[{
label: "Column",
value: "column1",
name: "01",
},
{
label: "Value",
value: "value1",
name: "02",
},
],
[{
label: "Column",
value: "column2",
name: "10",
},
{
label: "Value",
value: "value2",
name: "11",
},
],
];
But that's not how it can be saved to send the database, the way I need to send it is like this:
{
// other data
"column_names": {
"column1": "value1",
"column2": "value2"
}
}
Could you tell me how can I create an Object based on what the user types? But in the structure I showed in the second code snippet?