Is there a simple way to cancel DjangoJSONEncoder.ensure_ascii
and put it in False
or print text different from ascii in django.http.JsonResponse
in any other way?
Is there a simple way to cancel DjangoJSONEncoder.ensure_ascii
and put it in False
or print text different from ascii in django.http.JsonResponse
in any other way?
If you tend to use the utf-8 format, instead of Django's JsonResponse () use this form:
return HttpResponse(json.dumps(response_data, ensure_ascii=False),
content_type="application/json")
or this form:
return JsonResponse(json.dumps(response_data, ensure_ascii=False),
safe=False)
More about safe = False see HERE