1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
13 def load_json_file(full_path):
14 """Loads JSON from file
15 :param target_filename:
18 if not os.path.isfile(full_path):
19 raise Exception('File(%s) does not exist' % full_path)
21 with open(full_path, 'r') as file:
22 return json.load(file)
25 def write_json_file(full_path, data):
26 """write JSON from file
27 :param target_filename:
31 with open(full_path, 'w+') as file:
32 file.write(json.dumps(data))