Table of Contents
sqlalchemy object序列化为json
灵感来源于 Django REST framework
多个实例
posts = Post.query.all() serializer = Seralizer(posts,many=True) data = serializer.data
单个实例
post = Post.query.first() serializer = Seralizer(post,many=False) data = serializer.data
排除字段
serializer = Seralizer(post,exclude=['title'])
仅包括字段
serializer = Seralizer(post …