Fix json_object_get_boolean() doc for the object and array cases (always returns 0), and add those cases to the test_cast test.

See also issue #658.
This commit is contained in:
Eric Haszlakiewicz
2020-08-17 14:55:54 +00:00
parent cf30cba4ac
commit 2b439ea598
3 changed files with 48 additions and 2 deletions

View File

@@ -656,8 +656,9 @@ JSON_EXPORT struct json_object *json_object_new_boolean(json_bool b);
* The type is coerced to a json_bool if the passed object is not a json_bool.
* integer and double objects will return 0 if there value is zero
* or 1 otherwise. If the passed object is a string it will return
* 1 if it has a non zero length. If any other object type is passed
* 1 will be returned if the object is not NULL.
* 1 if it has a non zero length.
* If any other object type is passed 0 will be returned, even non-empty
* json_type_array and json_type_object objects.
*
* @param obj the json_object instance
* @returns a json_bool