On Fri, Sep 2, 2011 at 11:34 AM, Vineet Deodhar <d_vin...@yahoo.com> wrote: > Hi ! > Within a web framework, I want want to pass a python sequence (list or > tuple) to client-side javascript function as an array (javascript > compatible) > 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?) > > OR > 2) >>> import array >>> y = array.array(i, L) > then return y to javascript function > But the problem with this method is, it will give an array of basic values > only. > > OR > 3) Any other alternative? > > Thanks, > Vineet > --
The JavaScript Object Notation (JSON) is meant exactly for this purpose. -- http://mail.python.org/mailman/listinfo/python-list