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);
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。