This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wangchun
Recipients wangchun
Date 2009-05-25.09:22:43
SpamBayes Score 1.7299739e-08
Marked as misclassified No
Message-id <1243243366.01.0.202838739816.issue6105@psf.upfronthosting.co.za>
In-reply-to
Content
PEP-0372 and Issue 5381 both say json.dumps respect OrderedDict's 
iteration order, but the example in them do not work on my latest trunk 
build.

$ uname -a
Linux 12.38 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 
x86_64 x86_64 GNU/Linux
$ python2.7
Python 2.7a0 (trunk, May 21 2009, 08:00:00) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> from collections import OrderedDict
>>> items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 
5)]
>>> json.dumps(OrderedDict(items))
'{"four": 4, "three": 3, "five": 5, "two": 2, "one": 1}'
History
Date User Action Args
2009-05-25 09:22:46wangchunsetrecipients: + wangchun
2009-05-25 09:22:46wangchunsetmessageid: <1243243366.01.0.202838739816.issue6105@psf.upfronthosting.co.za>
2009-05-25 09:22:44wangchunlinkissue6105 messages
2009-05-25 09:22:43wangchuncreate