Normally jq exits with 0 as long as it could parse the input, whatever the answer was. With -e the exit code follows the result, and that turns jq into a test you can use in shell scripts.
if curl -fsS https://example.com/health | jq -e '.status == "ok"' >/dev/null; then
echo healthy
else
echo "not healthy"
fi
With -e, jq exits with 0 when the last output is anything other than false or null, and with 1 when it is one of those two. So .status == "ok" becomes a yes or no answer the shell understands, and jq -e '.items | length > 0' checks that a list isn’t empty.
I send the output to /dev/null because I only care about the exit code here; jq still prints true or false otherwise.
The catch is that a missing key counts as false too. jq -e '.enabled' fails both when the value is false and when the key isn’t there at all, and those can mean very different things. If you need to tell them apart, test with has("enabled") first. Also keep in mind that jq exits with a non zero code for real problems too, such as input that isn’t valid JSON or a typo in the filter, so a script that only checks for non zero treats broken JSON the same as an unhealthy service. That’s usually what I want for a health check, but not always.
Further reading: jq manual: exit status