Skip to content

Instantly share code, notes, and snippets.

@wong2
Created August 3, 2013 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wong2/6147032 to your computer and use it in GitHub Desktop.
Save wong2/6147032 to your computer and use it in GitHub Desktop.
flask jsonify decorator
import json
# jsonify response decorator
def jsonify(f):
def wrapped(*args, **kwargs):
return Response(json.dumps(f(*args, **kwargs)), mimetype='application/json')
return wrapped
@Fran-Rg
Copy link

Fran-Rg commented Feb 23, 2018

Need to add:

from flask import Response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment