What are the differences between json and simplejson Python modules?

JSONPythonServer Side ProgrammingProgramming

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. Although they are the same, the version included in the stdlib doesn't include the latest optimizations. So if you need (or want) the latest version, it's best to use simplejson itself, if possible.

A good practice, is to use one or the other as a fallback. For example,

try: import simplejson as json
except ImportError: import json
raja
Published on 20-Dec-2017 11:46:56
Advertisements