Skip to content

Instantly share code, notes, and snippets.

Last active Sep 29, 2018
What would you like to do?
merge two c2d (Carbid Create) files
import json
import argparse
# parse command line arguments
parser = argparse.ArgumentParser()
args = parser.parse_args()
# read first file
with open(args.master) as f:
master = json.load(f)
# read file to merge
with open(args.file_to_merge) as f:
file_to_merge = json.load(f)
# add all items from the second file to the first file, except the document properties
for key, item in file_to_merge.items():
if (key != 'DOCUMENT_VALUES') and (key in master):
# save result
with open(args.output_file, 'w') as f:
json.dump(master, f, indent=4, sort_keys=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment