-
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 mangles floats #627
Comments
The exponential form for floats is valid JSON. I'd mark this as a bug on On Mon, Nov 24, 2014 at 5:49 PM, travisbrady notifications@github.com
|
@wtlangford so you think jq should reformat that? Why not just leave it as is? @stedolan the reason I noticed this is that I'm also an OCamler and Yojson/Atdgen explodes on this sort of thing. This just looks incorrect irrespective of any other libraries/tools you might be using: $ echo '{"ids" : [1240999999,1241000000,1241000001]}' | jq '.'
{
"ids": [
1240999999,
1.241e+09,
1241000001
]
} |
Well, I'm not sure about whether we should reformat. The issue is due to Regardless of what we do here, I'd argue that the other programs /should/ That being said, I'm not a fan of the exponential form and wouldn't be sad On Tue, Nov 25, 2014, 18:10 travisbrady notifications@github.com wrote:
|
It's not that jq reformats numbers. It's that jq parses them as IEEE754 doubles, then jq formats those on There's been a lot of talk about fixing this, but it's difficult. There's |
One of the ideas bandied about is to allow for number formatting options to FYI, JSON processors are allowed to do these sorts of transformations. |
See issues like #218. |
Closing as a duplicate of #218. |
I often use jq to filter json before piping to other programs and those other programs die when they hit examples like this:
The text was updated successfully, but these errors were encountered: