This is the command I use to pull the info I need:
.results | .[] | {id, name: .general.name, platform: .general.platform, site: .general.site.name, ea_site: .extensionAttributes.[] | select(.definitionId=="57").values.[]}
When .extensionAttributes.[] | select(.definitionId=="57").values.[]
is empty, jq does not display any associated items at all.
What I'd like to do is check if .extensionAttributes.[] | select(.definitionId=="57").values.[] < 0
and return empty otherwise return the content. I'm trying to use if-then-else-end, but can't seem to get the syntax correct.
You can find sample data in jqplay here.Line 1218 in the json input has the empty value.