-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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_object_get_boolean() returns wrong result for objects and arrays #658
Comments
…ays returns 0), and add those cases to the test_cast test. See also issue #658.
This code has always returned 0 for objects and arrays, so I'd call this a doc bug, not a code bug. Thanks for the pulll request, but I won't be merging it currently. Instead, I added an item to the proposed 1.0 changes to consider it there. |
Ok, I understand the decision, given json-c has always done it that way. Now that it is documented, I'm fine ;-) But I still support a 1.0 change that would make this to work like the documentation said until now - because that's exactly what JS's Boolean() does and thus is widely expected behaviour. I stumbled over this after hours of debugging a case where a message could be false or a json object, and the test was just json_object_get_boolean(), which would have worked according to the docs... (Once found, it was easy to add a wrapper which tests in the way JS would) |
… false for arrays and objects Bug was reported on github: json-c/json-c#658 PR for fixing the bug: json-c/json-c#659
Describtion of the bug
The current implementation of
json_object_get_boolean(jobj)
returns 0 (false) whenjobj
is ajson_type_object
orjson_type_array
.This seems to be in contrast to the expected behaviour as documented, which is:
Steps To Reproduce
Output of this is:
Version and Platform
The text was updated successfully, but these errors were encountered: