From b69fa1f8b7b935c79b193502358bd59b685afd77 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Tue, 21 Feb 2012 10:22:34 -0500 Subject: [PATCH] Let's sort the keys so that this test passes even with random hashes. --- Lib/json/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 56116f482f1..b2fae9d32e4 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)::