Anton I. Sipos
unread,Dec 14, 2010, 6:03:33 PM12/14/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to simplejson-discuss
I'm trying to serialize the following data structure, that uses
integers as keys to a dictionary. In the result, the keys show up as
strings:
>>> simplejson.dumps({1:'foo', 2:'bar'})
'{"1": "foo", "2": "bar"}'
Which is the same result of this dictionary:
>>> simplejson.dumps({"1":'foo', "2":'bar'})
'{"1": "foo", "2": "bar"}'
Is there a way to get simplejson to serialize the keys as numbers? I'm
using simplejson 2.1.1.
Thanks.