generalize data conversion