turning this
[{"running": true, "name": "string1"}, {"running": "false"}, {"running": true, "name": "string2"}]
Into this
[{"item": "string1"}, {"item": "string2"}]
So basically filter all objects which have running property, and return a new array of those object names with a constant key prepended
jq ".[] | select(.running == true) | { item: .name }"
jq "[ .[] | select(.running == true) | { item: .name } ]"
Обсуждают сегодня