from flask import Flask, jsonify app = Flask(__name__) @app.route('/api/get-json') def hello(): return jsonify(hello='world') # Returns HTTP Response with {"hello": "world"}
person = {'name': 'Alice', 'birth-year': 1986} return jsonify(person)
@app.route("/") def index(): return flask.jsonify(response_value_1=1,response_value_2="value")
References
https://riptutorial.com/flask/example/5831/return-a-json-response-from-flask-api
https://www.kite.com/python/answers/how-to-return-a-json-response-using-flask-in-python