Something useful I found for shell scripts was:
jq '.foo // empty'
Which returns the match if successful, and the empty string if unsuccessful. So in bash I use:
addr=$(./xuez-cli getnetworkinfo | jq -r '.localaddresses[0].address // empty')
if [[ ! -z "$addr" ]]; then
# do something
fi
Ref: https://github.com/stedolan/jq/issues/354#issuecomment-43147898
https://unix.stackexchange.com/questions/451479/jq-print-for-null-values