I want to set a datetime object in json body and here is what I have been doing:
#createDate is fetched from a json output of some other API
createDate = document['createDate']
#Set in a json body
myjson = {}
myjson['date'] = dateparser.parse(createDate).astimezone(tz.tzutc())
But I get
TypeError: datetime.datetime(2014, 11, 13, 16, 23, 19, tzinfo=tzutc()) is not JSON serializable.
How to get over this?