django 使用HttpResponse返回json数据为中文

code

from django.http import HttpResponse
import json

def test(request):
    result = {"status":"错误","data":"","city":"北京"}
    #json返回为中文
    return HttpResponse(json.dumps(result,ensure_ascii=False),content_type="application/json,charset=utf-8")

原文地址:https://www.cnblogs.com/sea-stream/p/14182261.html