[Tutor] Json encode and decode on Puython 2.4

Prasad, Ramit ramit.prasad at jpmorgan.com
Wed Jan 16 22:50:02 CET 2013


Dotan Cohen wrote:
> 
> Hi all, I'm just getting into porting some PHP scripts to Python. One
> issue that I'm having is that the scripts need to run on a host with
> Python 2.4 that has neither the json nor simplejson packages
> available. I figure that I'll have to include the loads() and dumps()
> functions in my application. Where might I find the source for these
> two functions? What would be the best way to include them?
> 
> Thanks.
> 
> --
> Dotan Cohen

Python 2.4 is quite old and simplejson supports 2.5+. I can see a 
yield in the encoder code, so it is unlikely to be easy to modify 
and get working with 2.4. According to a stack overflow question
you may want to look at older releases (example: 2.0.9/2.1) as being
more 2.4 compatible.
SimpleJson source: https://github.com/simplejson/simplejson
Change the version in the link to see if PyPi has a different version.
http://pypi.python.org/pypi/simplejson/2.1.0 

I have no idea if you can get the json library to work with 2.4.
I did not seen anything in my cursory glance that suggested it would
not. 
http://hg.python.org/cpython-fullhistory/file/8e0b617c6c22/Lib/json/

You may want to see if you can get a newer python installed on 
the machine. You probably want it alt-installed so you are not
replacing the system expected Python.


~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list