# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test65
# FileName:      read_json.py
# Author:       lao_zhao
# Datetime:     2025/3/12 11:30
# 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 file_path.endswith(".json") and os.path.isfile(file_path):
        with open(file_path, mode="r", encoding="utf-8") as f:
            return json.load(f)
    else:
        raise FileNotFoundError("json文件的路径错误")

