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

floats ending with '.0' turns into ints #24

Open
jonathankarlsson opened this issue Mar 16, 2021 · 1 comment
Open

floats ending with '.0' turns into ints #24

jonathankarlsson opened this issue Mar 16, 2021 · 1 comment

Comments

@jonathankarlsson
Copy link

This hjson:
{
test: 1.0
}

turns into {test: 1} after hjson.loads(). A type() call says it is an int.
Maybe this is the wanted behavior? I just expected something else. "Normal" json returns a float.

@groodt
Copy link
Contributor

groodt commented Aug 7, 2022

Not sure this is an issue. The serializer here removes the .0 https://hjson.github.io/try.html

However, it is inconsistent with json.tool.

/tmp
.venv ❯ echo '{"test": 1.0}' | python3 -m json.tool
{
    "test": 1.0
}
/tmp
.venv ❯ echo '{"test": 1.0}' | python3 -m hjson.tool
{
  test: 1
}

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

2 participants