16 from __future__
import absolute_import
17 from __future__
import print_function
34 for json_object
in json_objects:
35 for key
in list(json_object.keys()):
36 if key
in list(merged.keys()):
37 if json_object[key] != merged[key]:
38 raise RuntimeError(
'Duplicate nonmatching key %s.' % key)
40 merged[key] = json_object[key]
53 for json_filename
in json_filenames:
54 json_file =
open(json_filename)
56 raise IOError(
'Unable to open json file %s.' % json_filename)
57 obj = json.load(json_file)
58 json_objects.append(obj)
63 print(json.dumps(merged, indent=2, sort_keys=
True))
65 if __name__ ==
"__main__":
67 json_filenames = sys.argv[1:]
int open(const char *, int)
Opens a file descriptor.
def merge_json_files(json_filenames)
def merge_json_objects(json_objects)