docs: def default(self, obj):
          """
          if input object is a ndarray it will be converted into a dict holding dtype, shape and the data base64 encoded
          """
          if isinstance(obj, np.ndarray):
              data_b64 = base64.b64encode(obj.data).decode('utf-8')
              return dict(__ndarray__=data_b64,
                          dtype=str(obj.dtype),
                          shape=obj.shape)
          elif sps.issparse(obj):
              data_b64 = base64.b64encode(obj.data).decode('utf-8')
              return dict(__ndarray__=data_b64,
                          dtype=str(obj.dtype),
                          shape=obj.shape,
                          indices=obj.indices,
                          indptr=obj.indptr)
          elif hasattr(obj, '__dict__'):
              return obj.__dict__
          # Let the base class default method raise the TypeError
          return json.JSONEncoder.default(self, obj)