import json


def pkg_get_name(pkg_file):
    """
    Parse JSON and gets the name of package
    """
    try:
        jfile = open(pkg_file)
    except (IOError, OSError) as err:
        print(err.args)
        raise
    else:
        try:
            data = json.load(jfile)
        except ValueError as err:
            raise
        finally:
            jfile.close()
    return data["name"]