js json parse bigint 丢失精度的问题

1.获取原始数据
2.使用正则替换bigint 为 string
3.JSON.parse()

const json = '{"smallNumber": 1, "bigNumber" : 9007199254740999}';
console.log(regexbig(json));
function regexbig(input:string) {
    // const re1 = input.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2')
 //  console.log(re1); return JSON.parse(input);
}

tumi
216 声望1 粉丝

只鸟归林