InterviewSolution
Saved Bookmarks
| 1. |
What is the use of jsonify() in Flask? |
|
Answer» One of the functions in the flask.json module is JSONIFY(). It converts data to JSON format and encapsulates it in a Response object with the application/JSON mime-type. It's worth NOTING that jsonify is occasionally imported DIRECTLY from the flask module rather than the flask itself. In other words, jsonify() is a Flask assist METHOD for appropriately RETURNING JSON data. jsonify() provides a Response object with the application/JSON mime-type set, whereas json.dumps() only returns a JSON data string. This could have unforeseen consequences. |
|