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

fix json#any bool value, fixed #3632 #3633

Merged
merged 1 commit into from Dec 4, 2016

Conversation

kostya
Copy link
Contributor

@kostya kostya commented Dec 3, 2016

No description provided.

@asterite
Copy link
Member

asterite commented Dec 4, 2016

Actually, if the underlying value is null maybe a JSON::Any with a value of nil should be returned. For example:

require "json"

p JSON.parse(%q<{"some": null}>)["some"].class # => JSON::Any

That is, there is a value in that position, it's just null.

I have a fix for this (using Hash#fetch(...) { ... } and Array#at(...) { ... }. I can push it, but I wanted to discuss this first.

@kostya
Copy link
Contributor Author

kostya commented Dec 4, 2016

i think null should be nil

@asterite asterite merged commit 79be773 into crystal-lang:master Dec 4, 2016
@asterite
Copy link
Member

asterite commented Dec 4, 2016

Yeah, I think the semantic difference is very tiny and returning nil is more convenient in the end

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

Successfully merging this pull request may close these issues.

None yet

2 participants