code: def to_json(self):  # pylint: disable=missing-function-docstring
      graph = self.value
      json_graph = {
          "nodes": [],
          "inputs": [],
          "outputs": [],
          "arguments": [],
      }
      for value_info in graph.value_info:
          self.argument(value_info.name)
      for initializer in graph.initializer:
          self.argument(initializer.name, None, initializer)
      for node in graph.node:
          op_type = node.op_type
          json_node = {}
          json_node_type = {}
          json_node_type["name"] = op_type
          type_metadata = self.metadata.type(op_type)
          if type and "category" in type_metadata:
              json_node_type["category"] = type_metadata["category"]
          json_node["type"] = json_node_type
          if node.name:
              json_node["name"] = node.name
          json_node["inputs"] = []
          for value in node.input:
              json_node["inputs"].append(
                  {"name": "X", "arguments": [self.argument(value)]}
              )
          json_node["outputs"] = []
          for value in node.output:
              json_node["outputs"].append(
                  {"name": "X", "arguments": [self.argument(value)]}
              )
          json_node["attributes"] = []
          for _ in node.attribute:
              json_attribute = self.attribute(_, op_type)
              json_node["attributes"].append(json_attribute)
          json_graph["nodes"].append(json_node)
      for _ in self.arguments:
          json_graph["arguments"].append(_.to_json())
      return json_graph
  
imports: import collections
  import enum
  import json
  import os
label_desc: Use image node_id 5 for calling the _Graph obj's underlying member method code with example usage: obj.to_json() and returns: json_graph