-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
jq is converting float values ending in .0 to integers. #1301
Comments
See https://github.com/stedolan/jq/wiki/FAQ#numbers The question of whether jq should do better has been addressed elsewhere on this website (e.g. #369, #627 ...). The prevailing view seems to be roughly that a JSON processor is not required to do better, but that indeed jq might one day do better. |
jq is not converting anything. It's just formatting the number. A far as the JSON standard goes, this behavior is perfectly OK. Internally jq parses numbers as C/IEEE754 doubles, which is why it loses formatting information (it doesn't keep around the original formatting). |
I just use Python and its |
Since google found this issue when I had the same problem and I spent time looking at jaq (https://github.com/01mf02/jaq) as a replacement (which also returns 2.0) not realising this is fixed in official jq now. I'm happy to say the 1.7.1 release available in this repo fixes it. jaq does look nice but it's not 100% compatible.
|
Example json:
Run this through jq:
jq should not touch the values, including dropping what it's apparently deeming a useless decimal.
The text was updated successfully, but these errors were encountered: