How to return a JSON response from the Flask view

from flask import Flask, jsonify, request
  
app =   Flask(__name__)
  
@app.route('/user', methods = ['GET'])
def get_user():
    if(request.method == 'GET'):
        data = {
            "name" :"Peter A",
            "email" : "test@pond.com"
        }
  
        return jsonify(data)
  
if __name__=='__main__':
    app.run(debug=True)