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

JSON boolean values not parsed as Julia Bool #275

Closed
lewisl opened this issue Jan 14, 2019 · 1 comment
Closed

JSON boolean values not parsed as Julia Bool #275

lewisl opened this issue Jan 14, 2019 · 1 comment

Comments

@lewisl
Copy link

lewisl commented Jan 14, 2019

{"mybool": "true"}

will parse into a Julia Dict as

d["mybool"]
"true"

with a type of String, naturally.

Since the JSON spec says to encode booleans as either "true" or "false", shouldn't the package recognize these and return valid Julian Bool?

I realize the performance implication is pretty terrible here because every string will need to be tested. I don't know if Python or Javascript returns language compatible booleans.

In my code I need to hard code tests for the presence of a key that I know will contain a boolean and convert the string to the corresponding bool value. This is kind of unfortunate--I won't always know in advance.

@lewisl
Copy link
Author

lewisl commented Jan 14, 2019

Forget it. If you leave out the "" surrounding true and false in the raw text of the JSON file, it all works.

@lewisl lewisl closed this as completed Jan 14, 2019
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