echo 1152921504606846976 | jq
1152921504606847000 echo 1152921504606846976 | jq
1152921504606847000See https://www.ecma-international.org/ecma-262/6.0/#sec-ecmascr...
https://brendaneich.com/wp-content/uploads/2017/12/dotJS-201... et seq.
Here's the epic jwz rant on it: https://www.jwz.org/blog/2010/10/every-day-i-learn-something...
with Brendan Eich chiming in: https://www.jwz.org/blog/2010/10/every-day-i-learn-something...
> echo 1152921504606846976 | python -c 'import sys, json; print(json.load(sys.stdin))'
1152921504606846976
It's less "interoperable" but not strictly invalid, by my read.
Therefore, you can't assume that if you pass some JSON through an arbitrary pipeline of JSON-manipulating tools, written in various languages, that your integer values will be passed through losslessly.
Therefore, you just shouldn't use JSON integer values when you know that the values can potentially be large. This is why e.g. Ethereum's JSON-RPC API uses hex-escaped strings (e.g. "0x0") for representing its "quantity" type.
Still interesting to know it's not just a jq quirk.
>JSON is agnostic about the semantics of numbers ... JSON instead offers only the representation of numbers that humans use: a sequence of digits.
So... anything is valid, per the spec.