To create a JSON response using Django and Python, we can use the JsonResponse
class.
For instance, we write
from django.http import JsonResponse
return JsonResponse({'foo':'bar'})
to create a JsonResponse
instance with a dictionary that we want to return as the response JSON body.