Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Date handler for JSON dumps if the error is JSON can't serializable
# convert datetime object to ISO format, so json.dumps() works
def date_handler(obj):
return obj.isoformat() if hasattr(obj, 'isoformat') else obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.