I am trying to convert a quote number to a string, inside a JSON.stringify()
The number is behaving like a BIGINT so it cannot be changed after parsing
When parsed as an INT the number 950375379233915148
turns into 950375379233915100
let json= "[{\"IDItem\":1111111,\"ItemName\":\"Test\",\"startDate\":\"Aug 31 2020 12:00AM\",\"FinishtDate\":\"Aug 31 2020 12:00AM\",\"startTime\":\"10:30:00.0000000\",\"itemNum\":123564554,\"Place\":\"10\",\"IDItemType\":30,\"Remark\":null,\"SmooveId\":0,\"WebinarKey\":950375379233915148,\"FullDescription\":null,\"ItmCode\":\"TE\",\"isPublic\":false,\"ActiveUserID\":1}]"
Trying to replace by regex:
json.replace(/WebinarKey":(\d.+),/, "WebinarKey\":\"$1\",")
That's what I get:
"[{
"IDItem":1111111,
"ItemName":"Test",
"startDate":"Aug 31 2020 12:00AM",
"FinishtDate":"Aug 31 2020 12:00AM",
"startTime":"10:30:00.0000000",
"itemNum":123564554,
"Place":"10",
"IDItemType":30,
"Remark":null,
"SmooveId":0,
"WebinarKey":"950375379233915148,"FullDescription":null,"ItmCode":"TE","isPublic":false",
"ActiveUserID":1
}]"
The replace function converts the string of all variables starting from "WebinarKey"
to "isPublic"
i.e. it adds the quote after false"
and I just want to convert the variable "WebinarKey" content to string