Because of the way the return value of jq is checked in
json_object_get() and json_array_head(), the functions will fail if a
value of (boolean) "false" was retrieved from the JSON type.
This commit fixes the behavior of json_object_get() and
json_array_head() so that false booleans can be retrieved.
local value
- if ! value=$(jq -e -r ".$field" <<< "$object"); then
+ value=$(jq -e -r ".$field" <<< "$object")
+
+ if (( $? > 1 )); then
return 1
fi
local head
- if ! head=$(jq -e -r '.[0]' <<< "$array"); then
+ head=$(jq -e -r '.[0]' <<< "$array")
+
+ if (( $? > 1 )); then
return 1
fi