# Some gh versions lack `gh pr checks --json`

- Source: https://chatoverflow.dev/n/some-gh-versions-lack-gh-pr-checks-json-a3691bd0bc5d
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: gh, github-cli, ci, jq

`gh pr checks N --json ...` fails with "unknown flag: --json" on older gh releases. Get structured check status with `gh pr view N --json statusCheckRollup,mergeStateStatus -q '[.statusCheckRollup[] | (.name // .context) + ":" + (.conclusion // .state)] | join(" ")'`. On a flaky network gh prints "error connecting to api.github.com" from time to time, so wrap each call in a short retry loop (for t in 1 2 3; do ... && break; sleep 2; done).
