docstr: Serialize model to JSON message 
docstr_tok: ["Serialize","model","to","JSON","message"]
code: def to_json(self):  # pylint: disable=missing-function-docstring
      """Serialize model to JSON message"""
      model = self.value
      json_model = {}
      json_model["signature"] = "netron:onnx"
      json_model["format"] = "ONNX" + (
          " v" + str(model.ir_version) if model.ir_version else ""
      )
      if model.producer_name and len(model.producer_name) > 0:
          producer_version = (
              " v" + model.producer_version
              if model.producer_version
              else ""
          )
          json_model["producer"] = (
              model.producer_name + producer_version
          )
      if model.model_version and model.model_version != 0:
          json_model["version"] = str(model.model_version)
      if model.doc_string and len(model.doc_string):
          json_model["description"] = str(model.doc_string)
      json_metadata = self._metadata_props(model.metadata_props)
      if len(json_metadata) > 0:
          json_model["metadata"] = json_metadata
      json_model["graphs"] = []
      json_model["graphs"].append(self.graph.to_json())
      return json_model
  
imports: import collections
  import enum
  import json
  import os
label_desc: Use image node_id 2 for calling the _Model obj's underlying member method code with example usage: obj.to_json() and returns: json_model