title: Merge multiple JSON files (more than two)
body: <p>I would like to merge multiple JSON files into one file. All of those files have the same structure. For example I've created three files which would look like this:</p>
  
  <p><strong>ExampleFile_1</strong> </p>
  
  <pre><code>    {
        "items": [
          {
            "answers": [
              {
                "creation_date": 1538172165
              },
              {
                "creation_date": 1538172205
              },
              {
                "creation_date": 1538172245
              }
           ],
         "creation_date": 1538172012,
         "question_id": 52563137
         }
        ]
      }
  </code></pre>
  
  <p><strong>ExampleFile_2</strong></p>
  
  <pre><code>    {
        "items": [
          {
            "answers": [
              {
                "creation_date": 1538326991
              }
            ],
          "creation_date": 1538172095,
          "question_id": 52563147
          },
          {
            "answers": [
              {
                "creation_date": 1538180453
              }
            ],
          "creation_date": 1538172112,
          "question_id": 52563150
          }
        ]
      }
  </code></pre>
  
  <p><strong>ExampleFile_3</strong></p>
  
  <pre><code>   {
         "items": [
            {
              "answers": [
                {
                   "creation_date": 1538326991
                }
              ],
                "creation_date": 1538172095,
                "question_id": 52563147
             }
          ]
       }
  </code></pre>
  
  <p>Now I would like to merge all three files inside the <code>"items"</code> list into one file which then would like this:</p>
  
  <p><strong>merged_json.json</strong></p>
  
  <pre><code>   {
         "items": [
          {
           "answers": [
              {
                "creation_date": 1538172165
              },
              {
                "creation_date": 1538172205
              },
              {
                "creation_date": 1538172245
              }
            ],
              "creation_date": 1538172012,
              "question_id": 52563137
            },
            {
              "answers": [
               {
                 "creation_date": 1538326991
               }
              ],
             "creation_date": 1538172095,
             "question_id": 52563147
            },
            {
             "answers": [
               {
                 "creation_date": 1538180453
               }
              ],
              "creation_date": 1538172112,
              "question_id": 52563150
            },
            {
              "answers": [
                {
                   "creation_date": 1538326991
                }
              ],
              "creation_date": 1538172095,
              "question_id": 52563147
             }
          ]
       }
  </code></pre>
  
  <p>So like above the <code>"items"</code> should be concatenated.</p>
  
  <p>I already tried to come up with a solution but could not figure it out. 
  This is what I got so far:</p>
  
  <pre><code>read_files = glob.glob("ExampleFile*.json")
  output_list = []
  
  for f in read_files:
      with open(f, "rb") as infile:
          output_list.append(json.load(infile))
  
  all_items = []
  for json_file in output_list:
      all_items += json_file['items']
  
  textfile_merged = open('merged_json.json', 'w')
  textfile_merged.write(str(all_items))
  textfile_merged.close()
  </code></pre>
  
  <p>This, unfortunately, leaves me with a messed up json file which only consists of the dicts inside <code>"items"</code>.</p>
  
  <p>How do I create such a file like <code>merged_json.json</code>?</p>
  
  <p>Thanks in advance.</p>