A confusion of getting to the bottom of a jq parse.
I'm learning, apreciate your help.
Two arrays here, both with same type ouput result, just integer values (spaced), same for string values.
Ex: 1 2 3 4 5
A multi-nested weather dump:I trying to understand to return just an index ([0...]) value or/and an array to sort - json and/or bash of the values. I've tried, and yes have read the man, jq i'm loving, just ?...
#Query 1
drp=$(cat "$HOME/..." | jq '.DailyForecasts[].Day.RainProbability | .')
JSON: -- The query above works fine gives integer output, there are 5 array sets so 5 digits: number number number number number - space separated, no [] .
"Day": {"Icon": 2,"IconPhrase": "Mostly sunny","HasPrecipitation": false,"ShortPhrase": "Mostly sunny and breezy","LongPhrase": "Mostly sunny and breezy","PrecipitationProbability": 1,"ThunderstormProbability": 0,"RainProbability": 1,"SnowProbability": 0,"IceProbability": 0,"Wind": {"Speed": {"Value": 15,"Unit": "mi/h","UnitType": 9 ... }
#Query 2:Ive tried to map, etc, number of ways (ex. going for the grass value).
JSON: -- Same description as Query 1
apg=$(cat "$HOME/..." | jq '.DailyForecasts[].AirAndPollen | .[1] | .Value | .')"AirAndPollen": [ {"Name": "AirQuality","Value": 44,"Category": "Good","CategoryValue": 1,"Type": "Ozone" }, {"Name": "Grass","Value": 12,"Category": "Moderate","CategoryValue": 2 }, ... ]