How to replace simplejson with json in django python?

My views have the following code:

def __init__(self, obj='', json_opts={}, mimetype="application/json", *args, **kwargs): content = simplejson.dumps(obj, **json_opts) super(JSONResponse, self).__init__(content, mimetype, *args, **kwargs) 

Since simplejson will be deprecated, can I use this

 content = json.dumps(obj, **json_opts) 

or do i need to do more?

+6
source share
2 answers

According to this answer , json is simplejson . However, according to this release note , there may be some incompatibility depending on the version of simplejson . In any case, you will want to replace simplejson with json at some point. Just make sure you test your code before pushing it into production.

+4
source

Use python json instead:

Django 1.5 Release Notes

 import json 
+5
source

All Articles