request json validation in the flask

Viewed 11016

Is there some best practice how to validate json request in Flask? There is interesting approach in the Flask restful extension but I don't need it in my app. I just want to have something like this:

user_schema = {
    'username': email,
    'password': required,
    'age': required
}


@app.route('new_user/', methods=['POST'])
def new_user():
    validate_json(request.json, user_schema)
1 Answers
Related