import json
import os

from API2 import log_decorator


@log_decorator
def read_json(file_path):
    """读取json文件，将json文件的内容序列化为python对象，再返回"""
    if isinstance(file_path, str) and os.path.isfile(file_path) and file_path.endswith(".json"):
        with open(file_path, mode="r", encoding="utf-8") as f:
            return json.loads(f.read())
    else:
        raise FileExistsError("json文件路径错误")


if __name__ == '__main__':
    read_json(r"E:\untitled\API2\data_config\sql_data.json")
