def AuthorToJSON(author):
    """
    Converts an Author object into a JSON-compatible dictionary.
    Returns None on failure.
    """
    if not author:
        return None
    try:
        json_dict = {
            "type":"author",
            "id":author.url,
            "host":author.host,
            "displayName":author.username,
            "url":author.url,
            "github":author.github
        }
        return json_dict
    except:
        return None