def json_encode_np(obj):
 if isinstance(obj, np.ndarray):
  return list(obj)
 elif isinstance(obj, np.float32):
  return float(obj)
 elif isinstance(obj, np.float64):
  return float(obj)
 elif isinstance(obj, np.int32):
  return int(obj)
 elif isinstance(obj, np.int64):
  return int(obj)
 else:
  return obj

def json_encode_np ( obj ) : if isinstance ( obj , np . ndarray ) : return list ( obj ) elif isinstance ( obj , np . float32 ) : return float ( obj ) elif isinstance ( obj , np . float64 ) : return float ( obj ) elif isinstance ( obj , np . int32 ) : return int ( obj ) elif isinstance ( obj , np . int64 ) : return int ( obj ) else : return obj
json cant serialize numpy types .