Erol Guzoğlu
Erol Guzoğlu

Reputation: 486

For loop for every object Jq

I'm trying to compare two attributes on every object. This is the code i use for this problem:

(.result[].downlaodable or .result[].playable) but this time jq does cartesian product. If i have 3 object, jq turns me 9 object.

I have to convert it to something like this:
(.result[1].downlaodable or .result[1].playable) (.result[2].downlaodable or .result[2].playable) (.result[3].downlaodable or .result[3].playable)

How can i do that?

Upvotes: 1

Views: 264

Answers (1)

Jeff Mercado
Jeff Mercado

Reputation: 134901

Change your filter to generate the results once.

.result[] | .downloadable or .playable

Upvotes: 3

Related Questions