Drop items with null value
Keep only array items whose value field is not null
jq '[.[] | select(.value != null)]' data.json
More jq commands
-
jq 'group_by(.status) | map({status: .[0].status, count: length})' data.jsonCount records in each status group
-
jq 'flatten(1)' nested.jsonFlatten nested arrays by one level
-
jq 'INDEX(.[]; .id)' items.jsonBuild an object keyed by the id field
-
jq -s '.[0] * .[1]' base.json override.jsonDeep-merge two JSON files. Values from override.json win
-
jq '.config?.database?.host // "localhost"' config.jsonThe ? operator avoids errors if a step is not an object, and // falls back to localhost