How to iterate through a list of JSON response in Bash shell (Bash/Linux/ZShell/Mac)
I was writing a Bash shell script file that needs to query an URL endpoint with a curl, which then returns a JSON object response. One thing I had to do it to extract a list of all “name” values from the JSON object looking like one below.
Now, I could do myself a favor and simplify the process by using more powerful options like Javascript, Python, etc. However, due to other constraints and circumstances, I assumed Bash shell script is the best option.
So, although I have some good knowledge with Bash, I got lazy and Googled how to “iterate through list of json in bash,” which then gave me the result like this.
As you can notice, I read through quite a bunch of results. However, none of the answer was quite satisfactory. For example, this answer was found in Stackoverflow as one of top results.