class_docstr: Media object for trace tree data.
  
  Arguments:
      root_span (Span): The root span of the trace tree.
      model_dict (dict, optional): A dictionary containing the model dump.
          NOTE: model_dict is a completely-user-defined dict. The UI will render
          a JSON viewer for this dict, giving special treatment to dictionaries
          with a `_kind` key. This is because model vendors have such different
          serialization formats that we need to be flexible here.
class_docstr_tok: ["Media","object","for","trace","tree","data",".","Arguments",":","root_span","(","Span",")",":","The","root","span","of","the","trace","tree",".","model_dict","(","dict",",","optional",")",":","A","dictionary","containing","the","model","dump",".","NOTE",":","model_dict","is","a","completely-user-defined","dict",".","The","UI","will","render","a","JSON","viewer","for","this","dict",",","giving","special","treatment","to","dictionaries","with","a","`","_kind","`","key",".","This","is","because","model","vendors","have","such","different","serialization","formats","that","we","need","to","be","flexible","here","."]
code: def to_json(
      self, run: Optional[Union["LocalRun", "Artifact"]]
  ) -> dict:
      res = {"_type": self._log_type}
      # Here we use `dumps` to put things into string format. This is because
      # the complex data structures create problems for gorilla history to parquet.
      if self._model_dict is not None:
          model_dump_str = _safe_serialize(self._model_dict)
          res["model_hash"] = _hash_id(model_dump_str)
          res["model_dict_dumps"] = model_dump_str
      res["root_span_dumps"] = _safe_serialize(
          dataclasses.asdict(self._root_span)
      )
      return res
  
imports: import dataclasses
  import hashlib
  import json
  import typing
  from dataclasses import dataclass, field
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
  import wandb
  import wandb.data_types
  from wandb.sdk.data_types import _dtypes
  from wandb.sdk.data_types.base_types.media import Media
label_desc: Use image node_id 3 for calling the WBTraceTree obj's underlying member method code with example usage: obj.to_json(run) and returns: res