import json


def sort_topology_data(topology_instance):
    """
    Sort the keys of components and relations, so we can actually match it
    :param topology_instance: dictionary
    :return: list of components, list of relations
    """
    components = [json.dumps(component, sort_keys=True) for component in topology_instance["components"]]
    relations = [json.dumps(relation, sort_keys=True) for relation in topology_instance["relations"]]
    return components, relations