TypeError: Object of type set is not JSON serializable This is the error I'm getting

TypeError: Object of type set is not JSON serializable This is the error I'm getting

from flask import Flask, request
from flask_restful import Api, Resource
import db_conn
app = Flask(__name__)
api = Api(app)


class save_data(Resource):
def post(self):
    conn = None
    cur = None
    request_data = request.get_json()
    try:
        conn = db_conn()
        cur = conn.cursor()
        save_name = request_data["save_name"]
        save_data = request_data["data"]
        query = "insert into OMS_ORD_DATA.OMS_ALLC_SCENARIOS (TEMPLATE, DIVISION_ID ,CREATION_DATE, CREATED_BY " \
                "VALUES  ({} , '1', SYSDATE, '-4')".format(save_data)
        cur.execute(query)
        lines = cur.fetchall()
        print(lines)
        return {"msg":"Data Saved Success"}
    except Exception as e:
        return {"Error: ", str(e)}
    finally:
        if cur is not None:
            cur.close()
        if conn is not None:
            conn.close()

api.add_resource(reload_data, '/reload_data')
if __name__ == '__main__':
  app.run(host="localhost", port=8888, debug=True)

我想将 API 输入的 JSON 数据插入 oracle table, API 输入:

{
"save_name":"ETL FULLREFRESH load",
"data":[
    {
      "name":"ETL",
      "priority":1
    },
    {
      "name":"Full Refresh",
      "priority":1
    },
    {
      "name":"POPM",
      "priority":2
    }
     ]
}

TypeError:类型集的对象不是JSON可序列化的 上面的错误正在弹出,我尝试使用 q1 = {'data': [dict(zip(tuple(query.keys()), i)) for i in query.cur]}

任何帮助或建议都会很有帮助,谢谢

您需要添加资源save_data,

api.add_resource(save_data, '/save_data')