From: Barry Warsaw Date: Tue, 21 Feb 2012 15:22:34 +0000 (-0500) Subject: Let's sort the keys so that this test passes even with random hashes. X-Git-Tag: v2.7.3rc1~17^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b69fa1f8b7b935c79b193502358bd59b685afd77;p=python Let's sort the keys so that this test passes even with random hashes. --- diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 56116f482f..b2fae9d32e 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -29,7 +29,7 @@ Encoding basic Python object hierarchies:: Compact encoding:: >>> import json - >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) + >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing (using repr() because of extraneous whitespace in the output)::