jq 'map(select(.age > 30))' data.json

Category: Data Science & Analysis

jq 'map(select(.age > 30))' data.json

Keep JSON objects where age exceeds 30

The select filter keeps only inputs that satisfy its condition, and map applies it to every element of the array. The result is a filtered array, the jq version of a WHERE clause. Comparison operators work on numbers, strings, and dates as expected. Chain another select after the pipe to add more conditions.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.