code: def default(self, obj):
          
          if isinstance(obj, np.ndarray):
              return obj.tolist()
          elif isinstance(obj, np.generic):
              return np.asscalar(obj)
          # Let the base class default method raise the TypeError
          return json.JSONEncoder(self, obj)
docs: If input object is an ndarray it will be converted into a list