问题
{
“id”: 1,
“name”: “张三”,
“age”: 30,
“email”: “zhangsan@example.com”,
“address”: {
“street”: “中山路101号”,
“city”: “北京市”,
“postcode”: “100000”
},
“isActive”: true,
“phoneNumbers”: [
{
“type”: “mobile”,
“number”: “13800138000”
},
{
“type”: “home”,
“number”: “010-12345678”
}
]
}
@app.route(“/user/add”, methods=[“POST”])
def add():
req = request.json
print(type(req))
return req.get(“age”)
# return req.get(“address”)
报错信息
<!doctype html>
500 Internal Server ErrorInternal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.