# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test60
# FileName:      read_json.py
# Author:       lao_zhao
# Datetime:     2024/5/20 14:13
# Description:
# 
# ---------------------------------------------------------------------------
import json
import os.path

from InterfaceAutoTest第三版 import log_decorator


@log_decorator
def read_json(filename):
    """读取json文件，将json文件的内容序列化为python对象"""
    if os.path.isfile(filename) and filename.endswith(".json"):
        try:
            with open(filename, mode="r", encoding="utf-8") as f:
                return json.load(f)
        except Exception as e:
            raise e
    else:
        raise FileNotFoundError("json文件的路径错误")