Skip to content

Instantly share code, notes, and snippets.

@martinbeentjes
Last active January 26, 2023 09:58
Show Gist options
  • Save martinbeentjes/be134561f818ca05c8ada6ac27558e36 to your computer and use it in GitHub Desktop.
Save martinbeentjes/be134561f818ca05c8ada6ac27558e36 to your computer and use it in GitHub Desktop.
Merge json files into one json file
#!/usr/bin/python
import json
import glob
result = []
for f in glob.glob("*.json"):
with open(f, "rb") as infile:
result.append(json.load(infile))
with open("merged_file.json", "wb") as outfile:
json.dump(result, outfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment