import json
import os
from v3 import log
def read_json(file_path):
    log.info(f"读取json文件，并将json文件序列化为python对象，传入的参数为{file_path}")
    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:
            try:
                return json.loads(f.read())
            except Exception as e:
                log.error(f"读取json文件时发生了{e}错误，错误类型是{type(e)}")
                raise e
    else:
        log.error(f"{file_path}对应的json文件不存在")
