You could delete arrays first, e.g.:
del(.[] | select(type=="array"))
To only keep objects do something like this:
<infile.json jq -r '
del(.[] | select(type!="object")) |
paths |
map(tostring) |
select(length==2) |
join(".")
'
Output:
coord.lon
coord.lat
main.temp
main.pressure
main.humidity
main.temp_min
main.temp_max
wind.speed
wind.deg
rain.1h
clouds.all
sys.type
sys.id
sys.country
sys.sunrise
sys.sunset
Edit
##Edit PerhapsPerhaps you want a combination of the two answers?
paths(scalars) |
select(length >= 2) |
map(tostring) |
join(".")
Output:
coord.lon
coord.lat
weather.0.id
weather.0.main
weather.0.description
weather.0.icon
main.temp
main.pressure
main.humidity
main.temp_min
main.temp_max
wind.speed
wind.deg
rain.1h
clouds.all
sys.type
sys.id
sys.country
sys.sunrise
sys.sunset