Table of Contents
Python Fix Object of type 'date' is not JSON serializable
My quick & dirty JSON dump that eats dates and everything:
json.dumps(my_dictionary, indent=4, sort_keys=True, default=str)
default
is a function applied to objects that aren't serializable.\
In this case it'sstr
, so it just converts everything it doesn't know to strings. Which is great for serialization but not so great when deserializing (hence the "quick & dirty") as anything might have been string-ified without warning, e.g. a function or numpy array.
https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable