import json


def file_to_json(mapfile):
    """ Given a filename string pointing to a JSON mapping, returns a
        dictionary representation of the JSON file
    """
    if isinstance(mapfile, str):
        with open(mapfile, 'r') as filehandle:
            return json.load(filehandle)
    else:
        return json.load(mapfile)