Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON module for python 2.4?

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?

like image 784
kdt Avatar asked Jul 20 '10 15:07

kdt


2 Answers

Now, a few years later, simplejson does only support python 2.5+. No more simplejson for systems stuck on 2.4. Even though it is not supported, you may find older packages on pypi. 2.0.9 or 2.1.0 should work.

pip install simplejson==2.1.0

(I could not comment on the chosen answer, but this just bit me hard, so it may be useful to others as well)

like image 75
sigurdga Avatar answered Nov 16 '22 07:11

sigurdga


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
like image 23
Thomas Wouters Avatar answered Nov 16 '22 07:11

Thomas Wouters