code: def default(self, obj):
      if isinstance(
          obj,
          (
              np.int_,
              np.intc,
              np.intp,
              np.int8,
              np.int16,
              np.int32,
              np.int64,
              np.uint8,
              np.uint16,
              np.uint32,
              np.uint64,
          ),
      ):
          return int(obj)
      elif isinstance(
          obj, (np.float_, np.float16, np.float32, np.float64)
      ):
          return float(obj)
      elif isinstance(obj, (np.ndarray,)):
          return obj.tolist()
      return json.JSONEncoder.default(self, obj)
  
imports: from abc import ABC, abstractmethod
  import os
  import copy
  import json
  import numpy
  from typing import Dict, Any, Optional, Union
  from typing_extensions import Protocol, runtime_checkable
  from alibi_detect.version import __version__
label_desc: Use image node_id 1 for calling the NumpyEncoder obj's underlying member method code with example usage: obj.default(obj) and returns: json, int, float, obj