tags:

views:

5277

answers:

3

I would like to use Python's JSON module. It was only introduced in Python 2.6 and I'm stuck with 2.5 for now. Is the particular JSON module provided with Python 2.6 available as a separate module that can be used with 2.5?

+19  A: 

http://pypi.python.org/pypi/simplejson/2.0.9

scooterXL
Thanks! There were so many json modules I wasn't sure which was the one used in Python 2.6.
marcog
Way late here, but how can you write a script to import either json or simplejson depending on the installed python version?
Wells
+1  A: 

I prefer cjson since it's much faster: http://www.vazor.com/cjson.html

David
I want to remain compatible with the default library provided with 2.6 though, otherwise I'd agree with you.
marcog
+8  A: 

To Wells and others:

Way late here, but how can you write a script to import either json or simplejson depending on the installed python version?

Here's how:

try:
    import json
except ImportError:
    import simplejson as json 

pkoch