# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test66
# FileName:      read_json.py
# Author:       lao_zhao
# Datetime:     2025/5/9 11:29
# Description:
# 
# ---------------------------------------------------------------------------
import json
import os
from APIAutoTest_v3 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"xxxew.json")