JSON module for python 2.4?
Asked Answered
S

3

22

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?

Scorpion answered 20/7, 2010 at 15:35 Comment(1)
Did you try simplejson? How did it work?Kazan
T
23

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
Thekla answered 20/7, 2010 at 15:59 Comment(2)
Python 2.4 is no longer supported by the latest versions of simplejson.Carrigan
You can get simplejson for 2.4 from here: pypi.python.org/packages/2.4/s/simplejsonMallett
T
26

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)

Thyratron answered 28/6, 2012 at 12:38 Comment(2)
Good hint, you're not the only one "stuck" on 2.4!Saxhorn
and for those who don't know the syntax: pip install simplejson==2.1.0Merciless
T
23

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
Thekla answered 20/7, 2010 at 15:59 Comment(2)
Python 2.4 is no longer supported by the latest versions of simplejson.Carrigan
You can get simplejson for 2.4 from here: pypi.python.org/packages/2.4/s/simplejsonMallett
T
2

I needed to get this up on an old box with Python 2.4.3. Used simplejson-1.7-py2.4.egg from here:

https://pypi.python.org/packages/2.4/s/simplejson/

Thematic answered 15/5, 2013 at 13:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.