问题
How can I prevent jq from truncating long decimal values?
For example:
echo '18302628978110292481' | jq .
result: 18302628978110292000
回答1:
Javascript does not support such big numbers and so does jq
. The integer size is 2^53
. Check this
To make it work, you'll need to treat them as strings:
echo '"18302628978110292481"' | jq .
# Prints "18302628978110292481"
来源:https://stackoverflow.com/questions/27211870/how-can-i-avoid-jq-truncating-long-decimal