Преобразуйте все строковые числа в нестроковые числа, используя map
и деструктурируя следующим образом:
const data = [
{
"label": "Purok I",
"y": "1"
},
{
"label": "Purok II",
"y": "1"
},
{
"label": "Purok III",
"y": "2"
}
];
const numbered = data.map(({ label, y }) => { return {label, y: parseInt(y)}});
console.log(numbered);
.as-console-wrapper { max-height: 100% !important; top: auto; }
Оказывается, создание имен свойств без строки невозможно:
var obj = {
foo: "bar",
one: 1
};
console.log(obj);
Попробуйте другой подход, именование ваших полей в запросе и именование параметров в запросе:
this.command.CommandText = "INSERT INTO StringData (field1, field2) VALUES(@param1, @param2)";
this.command.CommandType = CommandType.Text;
this.command.Parameters.Add(new SQLiteParameter("@param1", data.Data));
this.command.Parameters.Add(new SQLiteParameter("@param2", data.ByteIndex));
...