Networknet archive Blog

Tools: Parse and filter JSON output with jc and jq

Originally published

By Ivan Versluis

On my Debian jump box in AWS, I am exploring the IPv6 stack from the shell. I ran a ping against delta.nl, converted its output to JSON with jc, and used jq to extract the destination IP address and average round-trip time.

Bash1 line
1
ping -c 6 delta.nl | jc --ping -p | jq '.destination_ip,.round_trip_ms_avg'
Code2 lines
1
2
"2606:4700:4400::ac40:9425"
1.349

Next, I want to put this into a Bash script and make a POST request to InfluxDB. After that, I plan to create a Grafana dashboard.

References