I have following json
[
{
"ip":"105.105.105.105",
"timestamp":"1543746097",
"ports":[
{
"port":80,
"proto":"tcp",
"status":"open",
"reason":"syn-ack",
"ttl":128
}
]
},
{
"ip":"105.105.105.105",
"timestamp":"1543746097",
"ports":[
{
"port":53,
"proto":"tcp",
"status":"open",
"reason":"syn-ack",
"ttl":128
}
]
}
]
I want to extract ports to simple csv output
80,53
I tried
jq -r '.[]."ports" | map(.port) | @csv' 105.105.105.105_tcp.json
and
jq -r '.[]."ports" | map(.port) | join(",")' 105.105.105.105_tcp.json
but none of them work.