JQ: Select multiple conditions

JsonJq

Json Problem Overview


I have a json and at the moment using select to get only the data which match one condition, I need to filter based on more conditions.

For e.g:

.[] | select((.processedBarsVolume <= 5) && .processedBars > 0)

How I can do this ?

Json Solutions


Solution 1 - Json

jq supports the normal Boolean operators and/or/not, so it would look like:

.[] | select((.processedBarsVolume <= 5) and .processedBars > 0)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrei ColtaView Question on Stackoverflow
Solution 1 - JsonHans Z.View Answer on Stackoverflow