from django.http import JsonResponse def my_view(request): data = {'key': 'value'} return JsonResponse(data)