Closed djheart0710 closed 3 years ago
This is how V8's JSON.parse
works. You can use lossless-json for this though.
Use it like this:
const fetch = require('isomorphic-fetch');
const LosslessJSON = require('lossless-json');
setImmediate(async () => {
let response = await fetch(/* ... */);
let json = LosslessJSON.parse(await response.text());
console.log(json);
});
or perhaps use json-bigint?
Interesting problem ! Believe your question has been answered … …
In my project, I use fetch to process request. The result contains big numbers, which exceed the max number in JS. After response.json() , I got the data, but the big number data has already became wrong. For example, I got 14355897211814021 in Postman, but in project, I got 14355897211814020. How can I process the response got by fetch? Thanks!