|
@@ -34,6 +34,8 @@ def load_json(filename, encoding='utf-8'):
|
|
|
|
|
|
|
|
|
|
def save_json(filename, data, encoding='utf-8', sort_keys=False):
|
|
def save_json(filename, data, encoding='utf-8', sort_keys=False):
|
|
|
|
+ if not filename.endswith('.json'):
|
|
|
|
+ filename = filename + '.json'
|
|
with open(filename, 'w', encoding=encoding) as f:
|
|
with open(filename, 'w', encoding=encoding) as f:
|
|
json.dump(data, f, indent=4, separators=(',',': '),
|
|
json.dump(data, f, indent=4, separators=(',',': '),
|
|
ensure_ascii=False, sort_keys=sort_keys)
|
|
ensure_ascii=False, sort_keys=sort_keys)
|