import json


def parse_json_file(distribution_json_file):
    """
    Parse a json distribution file for a distribution id.
    Look for node of type 'dynamicPluginConfiguration' that contains the attribute id
    Note: The file should contains only one distribution.

    :param distribution_json_file: filepath
    :return: the distribution id found or None if not found
    """
    with open(distribution_json_file, 'r') as json_file:
        content = json.load(json_file)
        distributions = [node['id'] for node in content['childNodes'] if
                         node['tagName'] == 'dynamicPluginConfiguration']
        return distributions[0] if len(distributions) > 0 else None