【发布时间】:2021-06-12 01:49:01
【问题描述】:
如何在 Django 中向这个 JsonResponse 添加“points =”?
我的代码如下所示:
return JsonResponse(data=points, safe=False, json_dumps_params={'indent': 1})
结果:
[ { “x”:0, “是”:1 }, { “x”:0.315397047887207, “y”:0.694608645422627 } ]
我想做什么:
点=[ { “x”:0, “是”:1 }, { “x”:0.315397047887207, “y”:0.694608645422627 } ]
【问题讨论】:
-
您想要的返回不是有效的 JSON。你真的需要 JSON 响应吗?
标签: json python-3.x django jsonresponse