sidorares / json-bigint

JSON.parse/stringify with bigints support
MIT License
818 stars 196 forks source link

Unable to parse JSON with -0.8999999999999999 #92

Open vladaman opened 7 months ago

vladaman commented 7 months ago

Following code will throw an error:

let str = "{\"x\":-0.8999999999999999}";
console.log(JSONbig.parse(str));
/project/node_modules/json-bigint/lib/parse.js:215
            ? BigInt(string)
              ^

SyntaxError: Cannot convert 0.8999999999999999 to a BigInt
    at BigInt (<anonymous>)
    at number (/project/node_modules/json-bigint/lib/parse.js:215:15)
mois-ilya commented 3 months ago

Duplicate https://github.com/sidorares/json-bigint/issues/88