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

jq Conditional output

$
0
0

I'm using jq to play with json. I was wondering how to conditionally print something in that.

Say I am interested in a field call geo. I used the following command and find out there is only one entry whose geo is null:

% cat all.json | jq '.geo != null' | sort | uniq -c                 1 false6891 true

How can I print out that entry only without printing everything else?

Didn't see something like print command in the manual. And this doesn't work: cat all.json | jq 'if .place == null then . end'. jq complained about syntax error.


Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>