json in python 2.5

Vineet Deodhar d_vineet at yahoo.com
Sat Sep 3 07:36:56 CEST 2011

> e.g., I have this list:
> L = ['spam', 'ham', 'eggs', 12, (13.63)]
> What is the correct way to convert L to javascript array format?
> 1) jsonify the list and pass it to javascript
> (whether json format & javascript array are similar?)

JSON is in fact a subset of JavaScript, and modern browsers now
include a specific API for parsing and generating it
(https://developer.mozilla.org/En/Using_native_JSON ).
@Chris, thanks for the pointer on parsing json.
Python likewise has a JSON module in the std lib:
I tried with json in std lib.
But it is included in python 2.6 onwards.
For my current proj, I need to use python 2.5.
Hence can't use json from the std lib.
Any idea on converting list to json in python 2.5?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110902/13a32a87/attachment.html>

More information about the Python-list mailing list