title: Python: make a list generator JSON serializable
body: <p>How can I concat a list of JSON files into a huge JSON array? I've 5000 files and 550 000 list items. </p>
  
  <p>My fist try was to use <a href="http://stedolan.github.io/jq/">jq</a>, but it looks like jq -s is not optimized for a large input. </p>
  
  <pre><code>jq -s -r '[.[][]]' *.js 
  </code></pre>
  
  <p>This command works, but takes way too long to complete and I really would like to solve this with Python.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>def concatFiles(outName, inFileNames):
      def listGenerator():
          for inName in inFileNames:
              with open(inName, 'r') as f:
                  for item in json.load(f):
                      yield item
  
      with open(outName, 'w') as f:
          json.dump(listGenerator(), f)
  </code></pre>
  
  <p>I'm getting:</p>
  
  <pre><code>TypeError: &lt;generator object listGenerator at 0x7f94dc2eb3c0&gt; is not JSON serializable
  </code></pre>
  
  <p>Any attempt load all files into ram will trigger the OOM-killer of Linux. Do you have any ideas?</p>