4 ms·
Ran across this today and spent a good 20 to 25 minutes trying to debug why my own code was failing when it was jq that was rounding an id in the JSON response.
by codetrotter 5y ago
Ran across this today and spent a good 20 to 25 minutes trying to debug why my own code was failing when it was jq that was rounding an id in the JSON response.
Submitting this to let others that use jq beware of this :/
- neolog 5y agoThose numbers are so big, I'm curious what your use case is for them.
- arpa 5y agopartitioning using prefixes?
- NackerHughes 5y agoStoring Twitter IDs, of course!
- swebs 5y agoThe comment states that they're IDs.
- himinlomax 5y agoI've always (20+ years) known that Javascript numbers were floats, I've thus always assumed JSON numbers to be as well. Is this not the spec? I just store big integers in JSON strings.
- stkdump 5y agoJSON numbers are arbitrary precision, because the spec doesn't limit the precision in any way.
- weinzierl 5y agoYou are right, but as theamk pointed out in another comment, the spec does tell you to "expect no more precision or range than" IEEE754 doubles. So, don't count on arbitrary precision... [1] https://datatracker.ietf.org/doc/html/rfc7159#section-6 https://datatracker.ietf.org/doc/html/rfc7159#section-6
- tom_mellior 5y agoThanks for submitting this interesting issue. Out of interest, what system are you on, and did jq come from a package manager? If you build it from source, it should work: https://news.ycombinator.com/item?id=27362060 https://news.ycombinator.com/item?id=27362060
- codetrotter 5y agomacOS Big Sur on a MacBook Pro M1. Installed via the Homebrew package manager.