如何在django python中用json替换simplejson?
发布时间:2021-01-11 09:03:51 所属栏目:Python 来源:互联网
导读:我的观点中包含以下代码: def __init__(self, obj=, json_opts={}, mimetype=application/json, *args, **kwargs): content = simplejson.dumps(obj, **json_opts) super(JSONResponse, self).__init__(con
|
我的观点中包含以下代码: def __init__(self,obj='',json_opts={},mimetype="application/json",*args,**kwargs):
content = simplejson.dumps(obj,**json_opts)
super(JSONResponse,self).__init__(content,mimetype,**kwargs)
由于simplejson将被弃用,我可以使用它 content = json.dumps(obj,**json_opts) 还是我需要做更多? 解决方法根据 this answer,json是simplejson.但是,根据这个 release note,可能会有一些 incompatibilities,具体取决于您当前使用的simplejson版本.无论哪种方式,您都希望在某些时候用json替换simplejson.只需确保在将代码推送到生产环境之前对其进行测试.(编辑:南阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Python和R之间线性回归系数的差异
- python – hashlib.md5()TypeError:Unicode对象必须在散列
- python – 查找numpy数组中每行的最大值以及相同大小的另一
- python – 没有自我的内部类函数
- python – CherryPy日志记录:如何配置和使用全局和应用程序
- python – Django REST Framework中的camelCase POST数据
- python – Django中的Slugify字符串
- 如何在python中读出QLineEdit中的文本?
- python – ‘AnonymousUser’对象没有属性’后端’
- python – 网络特定节点标签
