[jq] Select objects whose property contains a given string

Created on November 28, 2026

You can combine select and contains to select objects whose property value contains a given string. The example below selects the object whose .name property contains to.

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

The command produces the following output.

{
  "name": "Satoshi",
  "age": 30
}
jq