import json


def get_metadata(bf):
    """ Return the metadata of a BIDSFile

    Parameters
    ----------
    bf : BIDSFile object

    Returns
    -------
    Dictionnary containing the metadata
    """
    filename = bf.path.replace(
        '.' + bf.get_entities()['extension'], '')
    with open(filename + '.json', 'r') as handle:
        return json.load(handle)