code: def default(self, obj):
          
          if isinstance(obj, np.ndarray):
              if obj.flags['C_CONTIGUOUS']:
                  obj_data = obj.data
              else:
                  cont_obj = np.ascontiguousarray(obj)
                  assert(cont_obj.flags['C_CONTIGUOUS'])
                  obj_data = cont_obj.data
              data_b64 = base64.b64encode(obj_data)
              return dict(__ndarray__=data_b64,
                          dtype=str(obj.dtype),
                          shape=obj.shape)
          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 dict
          holding dtype, shape and the data, base64 encoded.