Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 644

Replacing select condition with jq's `IN`

$
0
0

Given the simplified input:

[  [ "gpu" ],  [ "disk" ]]

I would like to select the arrays for which the first element is "gpu".

I can do it with a simple condition:

map(select(.[0] == "gpu"))
[  [ "gpu" ]]

But I don't understand what's wrong when I try to use the IN builtin instead:

map(select(.[0] | IN(["gpu"])))
[]

I'm using jq 1.6


Viewing all articles
Browse latest Browse all 644

Trending Articles