Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large numbers conversion to BigInt error #79

Closed
pavelsaman opened this issue Aug 6, 2022 · 4 comments
Closed

Large numbers conversion to BigInt error #79

pavelsaman opened this issue Aug 6, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@pavelsaman
Copy link

This JSON seems valid according to https://jsonlint.com/ and https://www.json.org/json-en.html:

{
    "largeNumer": 2.5e50
}

JSON Visio tries to convert it to BigInt and it fails:

SyntaxError: Cannot convert 05+e5 to a BigInt (at _app-3f3d54d5d6e3969c.js:1:48888)
    at BigInt (<anonymous>)
    at l (_app-3f3d54d5d6e3969c.js:1:48888)
    at Object.t [as num_to_s] (_app-3f3d54d5d6e3969c.js:1:49142)
    at e.encodeNum (_app-3f3d54d5d6e3969c.js:1:45639)
    at l (_app-3f3d54d5d6e3969c.js:1:47629)
    at Object.l [as addValue] (_app-3f3d54d5d6e3969c.js:1:47535)
    at e.compress (_app-3f3d54d5d6e3969c.js:1:45152)
    at Editor-1addf083bf22d274.js:1:20846
    at ei (framework-0471df08d5fed370.js:1:94315)
    at ws (framework-0471df08d5fed370.js:1:114733)
    at framework-0471df08d5fed370.js:1:113468
    at ks (framework-0471df08d5fed370.js:1:113534)
    at us (framework-0471df08d5fed370.js:1:107308)
    at jl (framework-0471df08d5fed370.js:1:47918)
    at framework-0471df08d5fed370.js:1:104703

image

I'd argue that keeping the number displayed with the exponent (e50) would be just fine since that's an allowed JSON number format.

@AykutSarac AykutSarac added the bug Something isn't working label Aug 6, 2022
@AykutSarac
Copy link
Owner

Looks like the issue is triggered by compression library.

@pavelsaman
Copy link
Author

Looks like the issue is triggered by compression library.

Possibly. There might be related tiny problems with strings, especially with escaped characters like: \n, \r, \/, and similar https://www.json.org/img/string.png

@sbres
Copy link

sbres commented Aug 31, 2022

I'm having the same problem with the json as a one-liner and post processed from jsonformatter.org/json-pretty-print
I'm having the break with a not so big value

1.98653973e-9

@kaungsithar
Copy link

kaungsithar commented Sep 11, 2022

I'm having the same problem with the json as a one-liner and post processed from jsonformatter.org/json-pretty-print I'm having the break with a not so big value

1.98653973e-9

@sbres It seems to be working now. Following is a screenshot with number as you mentioned.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants