def METHOD_NAME(self, obj):
    if isinstance(obj, int):
        return int(obj)
    elif isinstance(obj, float):
        return float(obj)
    elif isinstance(obj, np.ndarray):
        return obj.tolist()
    return json.JSONEncoder.METHOD_NAME(self, obj)