views:

97

answers:

1

I'm accustomed to doing import json in Python 2.6, however I now need to write some code for Python 2.4. Is there a JSON library with a similar interface that is available for Python 2.4?

+2  A: 

The json module in Python 2.6 is mostly the same as the simplejson third-party module, which is available for Python 2.4 as well. You can just do:

try:
    import json
except ImportError:
    import simplejson as json
Thomas Wouters
Perfect, many thanks.
kdt