Change data structure to a dict