+1 vote
by
Hi all. Not gravitas)
There is such a pen

as a result, data from forms go to json
{
"ItemToOrders": [{
"Qty": "1",
"FrameStyle": "2"
}],
"cotact": {
"city": "уу",
"country": "уу"
}
}


как сделать так, чтоб вокруг чисел небыло "кавычек"
вот например так
{
"ItemToOrders": [{
"Qty": 1,
"FrameStyle": 2
}],
"cotact": {
"city": "уу",
"country": "уу"
}
}

2 Answers

0 votes
by
 
Best answer
The regular season is possible:
const regex = /"(\d+)"/g;
const subst = `$1`;

const result = foo.replace(regex, subst);

console.log(result);
0 votes
by
in a loop through the array ItemToOrders allow its value to the number
...