Quantcast
Viewing all articles
Browse latest Browse all 526

Convert JSON array of key/value pairs into values with a comma seperator using jq

I have the following JSON.

{"foo": [      {"bar": "baz"      },      {"bar": "baz"      },      {"bar": "baz"      }    ]}

I'd like to convert this using jq into the following

"baz", "baz", "baz"

How do I do this using jq without any flags?

.foo.[].bar using https://jqplay.org/ gets you to having them on separate lines with no comma between them, but I need them to have commas in between and be on the same line.

"baz""baz""baz"

Viewing all articles
Browse latest Browse all 526

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>