code: def to_json(
      self, artifact: Optional["Artifact"] = None
  ) -> Dict[str, Any]:
      cl_dict = super().to_json(artifact)
      # TODO (tss): Refactor this block with the similar one in wandb.Image.
      # This is a bit of a smell that the classes object does not follow
      # the same file-pattern as other media types.
      if artifact is not None:
          class_name = os.path.join("media", "cls")
          classes_entry = artifact.add(
              self.wb_classes_obj_ref, class_name
          )
          cl_dict["params"]["classes_obj"] = {
              "type": "classes-file",
              "path": classes_entry.path,
              "digest": classes_entry.digest,  # is this needed really?
          }
      else:
          cl_dict["params"][
              "classes_obj"
          ] = self.wb_classes_obj_ref.to_json(artifact)
      return cl_dict
  
file_path: wandb/wandb/sdk/data_types/helper_types/classes.py
imports: import os
  from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Type, Union
  from ..None import _dtypes
  from ..base_types.media import Media
label_desc: Use image node_id 5 for calling the _ClassesIdType obj's underlying member method code with example usage: obj.to_json(artifact) and returns: cl_dict