-
Notifications
You must be signed in to change notification settings - Fork 74
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
Parsing zero-padded numbers #169
Comments
An example of another side-effect of the current implementation of
|
Related jqlang/jq#3055 jq used to allow whitespaces for |
Interesting. So yet another side effect of
|
@kklingenberg - Good catch re Since different dialects of jq have and will probably continue to have very different implementations of
it being understood that |
Regarding the "weird" number parsing behaviour for "0012": This is unfortunate, I agree, but it stems from the fact that sequences of JSON values are not standardised (I believe). First, JSON numbers cannot have multiple leading |
Regarding |
While parsing zero-padded numbers I came across this minor issue. This is a minimal example:
Whereas jq yields just
12
.This is
serde_json
at work, which in turn is probably following JSON's spec (is my guess). This is another view at the issue:Also, the lexer rejects these numbers too (which is fine, and consistent with the JSON parser). jq is also consistent with its lenient parser:
Anyway, while attempting to work with these numbers one could hope to use the
tonumber
filter, but that's also implemented in terms offromjson
, so no luck there.My suggestion is to either:
tonumber
filter that's more tolerantThe text was updated successfully, but these errors were encountered: