Skip to content
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

large int values get converted to floats when parsing json and outputting yaml #1756

Closed
jakkanen opened this issue Aug 11, 2023 · 2 comments
Closed
Labels

Comments

@jakkanen
Copy link

Describe the bug

int values with 7 or more digits become floats when parsed as json and outputted as yaml

Version of yq: 4.35.1
Operating system: mac
Installed via: homebrew

Input Yaml

data1.yml:

[999999, 1000000, 1000001]

Command
The command you ran:

yq -p json -o yaml data1.yaml 

Actual behavior

- 999999
- 1e+06
- 1.000001e+06

Expected behavior

- 999999
- 1000000
- 1000001

Additional context
not seeing ints getting mangled with -p yaml -o yaml, -p yaml -o json, or -p json -o json

@mikefarah
Copy link
Owner

Thanks for raising - problem was that the JSON decoder would parse those numbers as floats. Will be fixed in the next release.

@mikefarah
Copy link
Owner

Fixed in 4.35.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants