I think this is better, it also catches errors when trying to convert from Data to dict.