I\'m trying to make a Django function for JSON serializing something and returning it in an HttpResponse object.
HttpResponse
def json_response(something):
With newer versions of Django you can just use JsonResponse provided by django.http:
from django.http import JsonResponse def my_view(request): json_object = {'howdy': True} return JsonResponse(json_object)
You can find more details in the official docs.