Convert array to lines

Raw output (-r) for scripting; one value per line

cat data.json | jq -r '.items[].metadata.name'

tool
jq17 commands
tags
jq

More jq commands

  • jq -s '.[0] * .[1]' base.json override.json

    Deep-merge two JSON files (override wins)

  • jq '[.[] | select(.value != null)]' data.json

    Filter array elements where value is not null

  • jq 'group_by(.status) | map({status: .[0].status, count: length})' data.json

    Count records grouped by status field

  • jq 'flatten(1)' nested.json

    Flatten one level of nested arrays

  • jq 'INDEX(.[]; .id)' items.json

    Build an object keyed by the id field

all 17 jq commands