Answers for "sqlalchemy object of type time is not json serializable"

1

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)
Posted by: Guest on May-07-2021
0

TypeError: Object of type date is not JSON serializable

json.dumps(my_dictionary, indent=4, sort_keys=True, default=str)
Posted by: Guest on November-16-2021

Code answers related to "sqlalchemy object of type time is not json serializable"

Python Answers by Framework

Browse Popular Code Answers by Language