title: How to combine an array into a single string value when using CSV output in jq?
body: <p>I have the following <code>jq</code> command:</p>
  
  <pre><code>cat myFile.json | jq -r '.tickets[] | [.created_at, .id, .via.channel, .tags[]] | @csv'
  </code></pre>
  
  <p>And it outputs a line such as:</p>
  
  <pre><code>"2016-02-02T10:00:00Z",99999,"web","tag1","tag2","tag3","tag4"
  </code></pre>
  
  <p>I'm trying to <code>join</code> the <code>.tags[]</code> array, so that I can get:</p>
  
  <pre><code>"2016-02-19T13:25:55Z",99999,"web","tag1,tag2,tag3,tag4"
  </code></pre>
  
  <p>I've tried a few things, such as</p>
  
  <pre><code>cat myFile.json | jq -r '.tickets[] | [.created_at, .id, .via.channel, (.tags[] | join(","))] | @csv'
  </code></pre>
  
  <p>But it gives errors such as </p>
  
  <pre><code>jq: error (at &lt;stdin&gt;:0): Cannot iterate over string ("tag1...)
  </code></pre>
  
  <p>So, how can I join <code>.tags[]</code> in the command above so that instead of separate fields, I get a single string value (containing comma separated tag values in it)?</p>