Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert queryset to json django

from django.core import serializers
from django.http import HttpResponse

def some_view(request):
    qs = SomeModel.objects.all()
    qs_json = serializers.serialize('json', qs)
    return HttpResponse(qs_json, content_type='application/json')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #queryset #json #django
ADD COMMENT
Topic
Name
4+4 =