title: How to write a list to a JSON file without losing the comma
body: <p>I'm trying to develop code in Python that formats a list in a JSON file without removing the commas or brackets. The list is supposed to have each set of data on a new line. I'm able to handle the brackets on my own, but I'm having issues with the commas.</p>
  
  <p>I've already tried include a indent statement in .dump, but it's not the correct format.</p>
  
  <pre><code>    #Attempt 1
  
      for data in data:
          outfile.write('\t')
          json.dump(data, outfile)
          outfile.write('\n')
  
      #Attempt 2
      for obj in data:
          outfile.write('\t' + json.dumps(obj) + '\n')
  </code></pre>
  
  <p>Expected output</p>
  
  <pre><code>[
      [1, 12],
      [2, 7],
      [3, 6]
  ]
  </code></pre>
  
  <p>Actual output</p>
  
  <pre><code>[
      [1, 12]
      [2, 7]
      [3, 6]
  ]
  </code></pre>