from marshmallow import Serializer


class UserSerializer(Serializer):


    class Meta:
        fields = 'username'

def get_user_serialized(user):
    return UserSerializer(user).data
Python Sql Alchemy - How to jsonify a class object result from a database query