Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

gsseets TypeError: Object of type datetime is not JSON serializable code example

Example: object of type 'datetime' is not json serializable

from datetime import datetime
import json

class DateTimeEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, datetime):
            return o.isoformat()

        return json.JSONEncoder.default(self, o)

Tags:

Python Example

Related

show two date difference in php code example what does dependency injection mean code example javascript find dom element by attribute code example class which return current date in php code example django admin filter time code example expressjs routes list code example javascript deep copy es5 code example cumulative frequency in python code example color for comments vs code code example directive style angular code example 'numpy.ndarray' object has no attribute 'to' code example strtime now php code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy