docs: def to_json(graph: BELGraph) -> Mapping[str, Any]:
      """Convert this graph to a Node-Link JSON object."""
      graph_json_dict = node_link_data(graph)
  
      # Convert annotation list definitions (which are sets) to canonicalized/sorted lists
      graph_json_dict['graph'][GRAPH_ANNOTATION_LIST] = {
          keyword: list(sorted(values))
          for keyword, values in graph_json_dict['graph'].get(GRAPH_ANNOTATION_LIST, {}).items()
      }
  
      # Convert set to list
      graph_json_dict['graph'][GRAPH_UNCACHED_NAMESPACES] = list(
          graph_json_dict['graph'].get(GRAPH_UNCACHED_NAMESPACES, [])
      )
  
      return graph_json_dict