import re
import json


def load_data(file):
    """
    Load json data.

    Comments are allowed in source data.
    Comments must start with "//" and be the only content on the line.
    """
    pattern = re.compile(r'^\s*//.*$', re.M)
    data = None

    try:
        with open(file, mode='rb', encoding='utf-8') as f:
            raw_data = f.read()
            data = json.loads(re.sub(pattern, '', raw_data))
    except ValueError:
        raise ValueError('Failed to parse file: "{0}"'.format(file))

    return data