Django has some good automatic serialization of ORM models returned from DB to JSON format.
How to serialize SQLAlchemy query result to JSON format?
I tried
You could just output your object as a dictionary:
class User: def as_dict(self): return {c.name: getattr(self, c.name) for c in self.__table__.columns}
And then you use User.as_dict() to serialize your object.
User.as_dict()
As explained in Convert sqlalchemy row object to python dict