Proper encoding for data_dict