import json
import re


def get_all_users(in_json):
    """
    Read the users.json file.

    :param in_json:     Full path to the json file
    :return:            Parsed users json
    """
    print("Users: ")
    with open(in_json) as user_data:
        user_json = json.load(user_data)
        users = {}  # Dictionary to remember all users

        # Slackbot is not in users file -- add manually
        users["USLACKBOT"] = "slackbot"

        for usr in user_json:
            userid = usr["id"]
            if "real_name" in usr and usr["real_name"]:
                realname = usr["real_name"]
                if not re.match('.*[a-zA-Z].*', realname):
                    realname = usr["name"]
            else:
                realname = usr["name"]

            print("\t{}".format(realname))
            users[userid] = realname

        return users