code: def default(self, obj):
      if hasattr(obj, "to_dict"):
          return obj.to_dict()
      elif isinstance(obj, pathlib.PurePath):
          return str(obj)
      elif isinstance(obj, np.integer):
          return int(obj)
      elif isinstance(obj, np.floating):
          return float(obj)
      elif isinstance(obj, np.ndarray):
          return obj.tolist()
      else:
          return json.JSONEncoder.default(self, obj)
  
file_path: gluon-cv/gluoncv/torch/data/gluoncv_motion_dataset/utils/serialization_utils.py
imports: import json
  import pickle
  import pathlib
  import numpy
label_desc: Use image node_id 1 for calling the ComplexEncoder obj's underlying member method code with example usage: obj.default(obj) and returns: obj, str, int, float, obj, json