May-12-2019, 10:46 AM
This is a Python dict. The Python dict can converted with
If you use flask:
Other frameworks have also helpers for this task.
json.dumps(your_dict)
to a json-string.If you use flask:
from flask import jsonify # your code @app.route('/') def root(): message = { 'statusCode': 200, 'headers': {'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json'}, 'body': {'message': 'Successfully inserted'} } return jsonify(message)The jsonify function sets also the right content type in the headers.
Other frameworks have also helpers for this task.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!