code: def default(self, obj):
          
          if isinstance(obj, np.ndarray):
              return dict(__ndarray__=obj.tolist(),
                          dtype=str(obj.dtype),
                          shape=obj.shape)
          # Let the base class default method raise the TypeError
          return _json.JSONEncoder(self, obj)
docs: Converts an ndarray into a dictionary for efficient serialization.
  
          The dict has three keys:
          - dtype : The datatype of the array as a string.
          - shape : The shape of the array as a tuple.
          - __ndarray__ : The data of the array as a list.
  
          Parameters
          ----------
          obj : :obj:`numpy.ndarray`
              The ndarray to encode.
  
          Returns
          -------
          :obj:`dict`
              The dictionary serialization of obj.
          
          Raises
          ------
          TypeError
              If obj isn't an ndarray.