/ Published in: Django

This function takes anything which can be dumped into JSON and returns an HTTP response of it, with the right Content-type header.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def json_response(something): from django.utils import simplejson return HttpResponse(simplejson.dumps(something), content_type='application/json; charset=UTF-8')
Comments
