I have a dictionary called job_highlight_dict
which contains {job_id, JobHighlight}
job_id is number and JobHighlight
is a type as defined below:
class JobHighlight:
def __init__(self, display_salary, location, category):
self.display_salary = display_salary
self.location = location
self.category = category
I want to convert job_highlight_dict
to xml and write it to disk, this is what I have tried:
xml = dicttoxml.dicttoxml(self.job_highlight_dict)
file = open("export/path_%(time)s.xml", "wb")
file.write(xml)
file.close()
but I am getting the following error:
TypeError: Unsupported data type: <JobHighlight object at 0x000002D00FA48E88> (JobHighlight)