Lakshman Prasad Lakshman Prasad - 1 year ago 91
JSON Question

What are the differences between json and simplejson Python modules?

I have seen many projects using

module instead of
module from the Standard Library. Also, there are many different
modules. Why would use these alternatives, instead of the one in the Standard Library?

Answer Source

json is simplejson, added to the stdlib. But since json was added in 2.6, simplejson has the advantage of working on more Python versions (2.4+).

simplejson is also updated more frequently than Python, so if you need (or want) the latest version, it's best to use simplejson itself, if possible.

A good practice, in my opinion, is to use one or the other as a fallback.

try: import simplejson as json
except ImportError: import json
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download