[jq] Exclude objects whose property contains a given string

Created on November 28, 2026

You can use not to exclude objects whose property value contains a given string. This example keeps only the objects whose .name property does not contain to.

echo '[{"name": "Taro", "age": 25},{"name": "Satoshi", "age": 30}]' | jq '.[] | select(.name | contains("to") | not)'

The command produces the following output.

{
  "name": "Taro",
  "age": 25
}
jq