Add: settings values, json parser from file (function), demo example

This commit is contained in:
2024-02-08 22:37:54 +09:00
parent 961180a006
commit c8c7060201
7 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import json
import sys
def parse_json_file(file_path):
"""
Function read json file as usual config.json then parse it to python dict
Args:
config_file_path (str): path to config file
Returns:
dict: contains parse json content
"""
try:
with open(file_path, 'r') as f:
return json.load(f)
except Exception as error:
print(error)
sys.exit(1)