Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Metadata
ID:python-flask/use-jsonify
Language: Python
Severity: Notice
Category: Best Practices
Description
With the flask framework, jsonify helps you write API endpoints that return JSON data.
@app.route("/article")defget_article():article=get_article_by_id(request.args.get("id"))returnjson.dumps(article)# use flask.jsonify instead of json.dumps