因为用的是mongo数据库,有时会有Object类型的数据,返回时经常忘记转化为str,故就无脑转化为str类型吧 response.json({"code": 0, "message": "ok"}, dumps=json.dumps, default=str)