JSON.parse()上的数值更改

szn*_*brt 1 javascript parsing json node.js vine

我正在使用Node/Express向非官方Vine API发出API请求.

GET https://api.vineapp.com/users/search/路由返回的数据在解析时发生更改.

我的代码如下:

request({ url: 'https://api.vineapp.com/users/search/' + username }, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(typeof body,'UNPARSED BODY:', body);

  body = JSON.parse(body);

  console.log(typeof body,'PARSED BODY:', JSON.stringify(body, null, 2));

  cb(null, body)
});
Run Code Online (Sandbox Code Playgroud)

这是什么回报: 在此输入图像描述 data.records.userId在解析时发生更改.

为什么会这样?我在这里错过了什么吗?他们为什么要那样做?

Sim*_*sch 6

对于JSON解析器,该数字太高

有关javascript中可能的最高值的信息:
在不丢失精度的情况下,数字可以达到的JavaScript的最高整数值是多少?

这里提供了一个解决方案:
node.js有没有正确的方法来解析大数字的JSON?(long,bigint,int64)