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

Incorrectly converts string to number sometimes #78

Open
alasdairhurst opened this issue Oct 13, 2020 · 0 comments
Open

Incorrectly converts string to number sometimes #78

alasdairhurst opened this issue Oct 13, 2020 · 0 comments

Comments

@alasdairhurst
Copy link

Start out with this YAML file

timer: "1000"

Edit the JSON to change the timer value to "1001"

Expected result:

timer: "1001"

Actual result:

timer: 1001

As you can see, the string turned into an integer

I noticed sometimes it stays as a string depending on the structure of the document or the presence of comments but this is the simplest example that reproduces the issue I've been seeing. A pretty big one.

You can see it happening on the demo site too:
https://azimi.me/yawn-yaml/demo/index.html

Dragory added a commit to Dragory/yawn-yaml that referenced this issue Oct 17, 2020
Fixes mohsen1#78. This also fixes numbers larger than
Number.MAX_SAFE_INTEGER represented as strings being rounded
when the yaml is loaded and serialized again.

Causes a slight regression with the styling of string values.
Specifically, any strings that are modified in the JSON are quoted
in the resulting yaml, even if they weren't in the original.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant