I have a JSON file where items is an array and it has name
three times in it.
How do I iterate the loop using shell script so that using a single script, it outputs the value of name
for all the names in the array?
In my case, I should get the value of name
three times.
Here is what I am doing right now:
curl ***** | jq '.items[0].name'
curl ***** | jq '.items[1].name'
curl ***** | jq '.items[2].name'
How can I create a script that automatically fetches however many times name
appears in the items
array and then prints them one by one? Is it possible using some for
or while
loop?