etiquette/etiquette_flask/jsonify.py

10 lines
245 B
Python
Raw Normal View History

import flask
import json
def make_json_response(j, *args, **kwargs):
dumped = json.dumps(j)
response = flask.Response(dumped, *args, **kwargs)
response.headers['Content-Type'] = 'application/json;charset=utf-8'
return response