我有一个示例解析请求列表字典:
{
"shopping_cart": [{
"id": 23323,
"qty": 10
}, {
"id": 34232,
"qty": 9
}, {
"id": 34232,
"qty": 9
}]
}
我如何解析它使用flask_restful RequestParser?
答案 0 :(得分:3)
使用类似的东西:)
self.postreqparse = reqparse.RequestParser()
self.postreqparse.add_argument("shopping_cart", type=dict, action="append")