Which JSON module can I use in Python 2.5?

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?


You can use simplejson.

As shown by the answer form pkoch you can use the following import statement to get a json library depending on the installed python version:

try:
    import json
except ImportError:
    import simplejson as json 

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