Daily Archives: 14.11.2010
Отдача json из Django view
1 2 3 4 5 6 |
from django.http import HttpResponse import simplejson as json ... def my_view( request ): jsonDict = { "status": "success", "message": "everything's fine" } return HttpResponse( json.dumps( jsonDict ), mimetype="application/json" ) |
Подробнее о simplejson — в документации