How to get json file from sql db

Solution
from flask import jsonify

...
...
...

@app.route('/cal2')
def cal2():
  result = []
  calendar_entries = CalData.query.all()
  for entry in calendar_entries:
    obj = dict()
    obj['date'] = entry.date
    obj['title'] = entry.title
    ...
    result.append(obj)
  return jsonify(result)