Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-22 Thread saikari78
Thanks for all these very clarifying and useful replies -- http://mail.python.org/mailman/listinfo/python-list

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-22 Thread Paul Kölle
Am 21.11.2012 17:04, schrieb hfo...@gmail.com: Thanks for your reply, but the javascript function expects option names to be unquoted, otherwise it won't work. Others have shown you how to solve this, but I would like to note that the function does NOT expect JSON but a simple javascript object

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread Chris Rebert
On Wed, Nov 21, 2012 at 7:48 AM, MRAB wrote: > On 2012-11-21 14:59, saikari78 wrote: >> >> Hi, >> >> I'm using the json module to create a JSON string, then inserting that >> string into a html template containing a javascript function (from the >> highcharts library: http://www.highcharts.com/)

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread MRAB
On 2012-11-21 16:27, MRAB wrote:> On 2012-11-21 16:04, hfo...@gmail.com wrote: >> On Wednesday, November 21, 2012 3:48:07 PM UTC, MRAB wrote: >>> On 2012-11-21 14:59, saikari78 wrote: Hi, I'm using the json module to create a JSON string, then inserting that string into a ht

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread MRAB
On 2012-11-21 16:04, hfo...@gmail.com wrote: On Wednesday, November 21, 2012 3:48:07 PM UTC, MRAB wrote: On 2012-11-21 14:59, saikari78 wrote: Hi, I'm using the json module to create a JSON string, then inserting that string into a html template containing a javascript >>> function (from th

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread Grant Edwards
On 2012-11-21, MRAB wrote: >> However, I don't know how to do that because dictionary keys in >> python need to be strings. If I try to do the following, Python,of >> course, complains that y,color,drilldown, etc are not defined. > > Just quote them: > > data = [ { 'y':55.11, 'color':colors[0], '

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread hfolch
Thanks for your reply, but the javascript function expects option names to be unquoted, otherwise it won't work. On Wednesday, November 21, 2012 3:48:07 PM UTC, MRAB wrote: > On 2012-11-21 14:59, saikari78 wrote: > > > Hi, > > > > > > I'm using the json module to create a JSON string, then

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread MRAB
On 2012-11-21 14:59, saikari78 wrote: Hi, I'm using the json module to create a JSON string, then inserting that string into a html template containing a javascript function (from the highcharts library: http://www.highcharts.com/) The json string I'm trying to create is to initialize a data