How to Bash Loop Over JSON with jq

A common task I run into at work is I’ll need to iterate over some JSON in Bash. This is very easy to do in Python, but can be kind of annoying in Bash because sometimes your JSON is spread out over multiple lines, or sometimes your JSON values have whitespace or other special characters that get in your way when using Bash. In this post I’ll show some examples of how I handle it using jq. ...

March 7, 2026 · 2 min