def save_as_json(total: list,
                 name='data.json',
                 sort_by: str = None,
                 no_duplicate=False,
                 order='asc'):
    if sort_by:
        reverse = order == 'desc'
        total = sorted(total, key=itemgetter(sort_by), reverse=reverse)
    if no_duplicate:
        total = [key for key, _ in groupby(total)]
    data = json.dumps(total, ensure_ascii=False)
    Path(name).write_text(data, encoding='utf-8')