The short answer

Choose jq for JSON and yq when your workflow includes YAML. Multiple tools share the name yq, so confirm the implementation and syntax before copying a filter.

Try jq

Inspect the Homebrew package and its current installation instructions before adding it to your Mac.

brew info jq

jq and yq in practice

The examples select the same field from JSON and YAML respectively. Input format and the installed yq implementation matter when reusing filters.

Test filters on sample documents before using them to change important configuration.

printf '%s\n' '{"name":"Casklane"}' | jq '.name'
printf 'name: Casklane\n' | yq '.name'

Make the choice for your workflow

Consider portability, team conventions, output format, and whether you need an interactive tool or a scriptable interface. Test a representative task using non-sensitive data before changing existing automation.

Sources and further reading