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
literal numbers #83
Comments
I think gojq is just another jq-like syntax interpreter in the absence of specification. I'm confident it is highly compatible, but I already fixed some bugs of jqMaster and dropped some unimportant filters. |
For reference, jtc also preserves numeric precision for all JSON numbers:
jtc's author wrote: "jtc ... honors 100% JSON definition for numericals." |
First my congratulations on gojq, and for having closed out all the open issues. And thank you especially for adhering so closely to the "jq specification".
With regard to the "jq specification", there is, however, a looming problem, having to do with "numbers".
For clarity's sake, let me distinguish between "jq" and "jqMaster", the latter referring to the current "master" version of jq, and more specifically, to the (new) specification of the treatment of numeric literals.
As you know, the (new) approach to numeric literals (whether specified in JSON texts or in jq programs) is to ensure that they are treated with great respect, although not always "literally". The intent, though, is that jq filters such as
.
,tostring
andtonumber
should preserve the numeric accuracy of numeric literals.Thus, using jqMaster (the executable), we see:
So the looming issue stems from the fact that jqMaster honors the mathematical semantics of numeric literals,
whereas gojq only does so for integers.
I believe jqMaster's treatment of numbers accords well with what I believe was probably Douglas Crockford's original intention.
(That is, I think he probably intended that JSON semantics for "number" would accord with the normal meaning (in English and mathematics), which partly explains why the original specification was so focused on syntax.)
The text was updated successfully, but these errors were encountered: