docs: def json_encoder_default(obj):
      """Handle more data types than the default JSON encoder.
  
      Specifically, it treats a `set` and a `numpy.array` like a `list`.
  
      Example usage: ``json.dumps(obj, default=json_encoder_default)``
      """
      if np is not None and hasattr(obj, 'size') and hasattr(obj, 'dtype'):
          if obj.size == 1:
              if np.issubdtype(obj.dtype, np.integer):
                  return int(obj)
              elif np.issubdtype(obj.dtype, np.floating):
                  return float(obj)
  
      if isinstance(obj, set):
          return list(obj)
      elif hasattr(obj, 'to_native'):
          # DatastoreList, DatastoreDict
          return obj.to_native()
      elif hasattr(obj, 'tolist') and hasattr(obj, '__iter__'):
          # for np.array
          return obj.tolist()
  
      return obj