Merging Multiple (Ideally) JSON Files Into One
<p>Simple enough situation; I'm working from within a directory which contains a script, and a subdirectory at the same level which contains many JSON files. </p>

<p>Using ideally Python, I'd like to combine all of the JSON files into one. Depending on your suggestion, this may leave behind redundant headers, but I can pop those off the JSON as I convert that file into a python dictionary object. Not a problem.</p>

<p>The problem is that I have been unable to combine the files into one. I'm practicing on text files for a start, to no avail. I'm using the python "os" module, but no luck. Keenly;</p>

<pre><code>path = "/Users/me/ScriptsAndData/BagOfJSON"
...

for filename in os.listdir(path):
    with open(filename, 'rb') as read file:
    ....
</code></pre>

<p>Results in the error;</p>

<pre><code>   with open(filename, 'rb') as readfile:
FileNotFoundError: [Errno 2] No such file or directory: 'firstFile.JSON'
</code></pre>

<p>And this finds and names the first file from within the directory, but doesn't operate on it like a file.</p>

<p>tldr;</p>

<p>I'm trying to merge multiple JSON files, all located within a single directory, into a single JSON file. If you know how to do this for any filetype, I'd be happy to know how you do it, then build from there.</p>

<p>Cheers!</p>