[Solved] TypeError: Datetime Not JSON Serializable


If you get the following error:

TypeError: Object of type datetime is not JSON serializable

..then you can solve it by using this trick:

json.dumps(your_dict, indent=4, sort_keys=True, default=str)