# -*- coding: UTF-8 -*-
import json


def load_json(file):
    '''从json文件加载对象
    Args:
        file: 文件路径

    Returns:
        返回一个json对象
    '''
    with open(file, 'r') as f:
        return json.loads(f.read())


def load_json_list(file_list):
    results = []
    for file in file_list:
        results.append(load_json(file))
    return results


def dump_json(file, obj):
    '''将对象写入到一个json文件
    Args:
        file: 文件路径
        obj: 待写入文件的对象
    '''
    with open(file, 'w') as f:
        f.write(json.dumps(obj, indent=2, ensure_ascii=False))
