Skip to content
Advertisement

how to for loop a jq array result in shell script

I have a json data as below

JavaScript

now I can use below command line to get a list containing two dict, each dict have a key “data”, value is a list,

JavaScript

I want to print each dict with a loop in shell script

My except in each loop have printed a dict, total have 2 dict

But it seems like a string

below is my shell script

JavaScript

Does anyone have any idea?

Advertisement

Answer

JavaScript

Note that you can get very similar output with simpler jq:

JavaScript

And you can get identical output (this seems likely to be unnecessary) with:

JavaScript
Advertisement