class_docstr: Default JSON Encoder which encodes Jsonable object to JSON.
code: def default(self, obj: Any) -> Any:
      # If obj is a str-typed RuntimeParameter, serialize it in place.
      if (
          obj.__class__.__name__ == "RuntimeParameter"
          and obj.ptype == str
      ):
          dict_data = {
              _TFX_OBJECT_TYPE_KEY: _ObjectType.JSONABLE,
              _MODULE_KEY: obj.__class__.__module__,
              _CLASS_KEY: obj.__class__.__name__,
          }
          dict_data.update(obj.to_json_dict())
          return dumps(dict_data)
  
      if isinstance(obj, Jsonable):
          dict_data = {
              _TFX_OBJECT_TYPE_KEY: _ObjectType.JSONABLE,
              _MODULE_KEY: obj.__class__.__module__,
              _CLASS_KEY: obj.__class__.__name__,
          }
          # Need to first check the existence of str-typed runtime parameter.
          data_patch = obj.to_json_dict()
          for k, v in data_patch.items():
              if (
                  v.__class__.__name__ == "RuntimeParameter"
                  and v.ptype == str
              ):
                  data_patch[k] = dumps(v)
          dict_data.update(data_patch)
          return dict_data
  
      if inspect.isclass(obj):
          # When serializing, skip over deprecated class aliases in the class
          # hierarchy.
          obj = deprecation_utils.get_first_nondeprecated_class(obj)
          return {
              _TFX_OBJECT_TYPE_KEY: _ObjectType.CLASS,
              _MODULE_KEY: obj.__module__,
              _CLASS_KEY: obj.__name__,
          }
  
      if isinstance(obj, message.Message):
          return {
              _TFX_OBJECT_TYPE_KEY: _ObjectType.PROTO,
              _MODULE_KEY: obj.__class__.__module__,
              _CLASS_KEY: obj.__class__.__name__,
              _PROTO_VALUE_KEY: proto_utils.proto_to_json(obj),
          }
  
      return super().default(obj)
  
imports: import importlib
  import inspect
  import json
  from typing import Any, Dict, Type, Union, Mapping, Sequence
  from tfx.utils import deprecation_utils
  from tfx.utils import doc_controls
  from tfx.utils import proto_utils
  from google.protobuf import message
label_desc: Use image node_id 2 for calling the _DefaultEncoder obj's underlying member method code with example usage: obj.default(obj) and returns: super, dumps, dict_data, dict, dict