title: jq - Looping through json and concatenate the output to single string
body: <p>I was currently learning the usage of <code>jq</code>. I have a json file and I am able to loop through and filter out the values I need from the json. However, I am running into issue when I try to combine the output into single string instead of having the output in multiple lines.</p>
  <p>File <code>svcs.json</code>:</p>
  <pre><code>[ 
   {
     &quot;name&quot;: &quot;svc-A&quot;,
     &quot;run&quot; : &quot;True&quot;
   },
   {
     &quot;name&quot;: &quot;svc-B&quot;,
     &quot;run&quot; : &quot;False&quot;
   },
   {
     &quot;name&quot;: &quot;svc-C&quot;,
     &quot;run&quot; : &quot;True&quot;
   }
  ]
  </code></pre>
  <p>I was using the jq to filter to output the service names with <code>run</code> value as <code>True</code></p>
  <p><code>jq -r '.[] | select(.run==&quot;True&quot;) | .name ' svcs.json</code></p>
  <p>I was getting the output as follows:</p>
  <pre><code> svc-A
   svc-C
  </code></pre>
  <p>I was looking to get the output as single string separated by commas.</p>
  <p>Expected Output:</p>
  <p><code>&quot;svc-A,svc-C&quot;</code></p>
  <p>I tried to using join, but was unable to get it to work so far.</p>