Format values according to type in output