1👍
✅
You could use JsonResponse,
from django.http import JsonResponse
return JsonResponse({'body':body})
Then, you don’t have to do json.dumps,
For documentation, click here
If you want you could refer to this question, Creating a JSON response using Django and Python
0👍
Additionally, Json dumps returns a simply the json representation of the data you pass in so if that’s your goal then this method is adequate, but if you need to include any headers then you could simply pass in params and list into JSONResponse with any additional arguments while minimizing load.
Source:stackexchange.com