Published
- 1 min read
json dumps datetime
The solution for this is noted below
json dumps datetime
Solution
def myconverter(o):
if isinstance(o, datetime.datetime):
return o.__str__()
print(json.dumps(d, default = myconverter))
Try other methods by searching on the site. That is if this doesn’t work