#16476: Fix json.tool to avoid including trailing whitespace.
diff --git a/Lib/json/tests/test_tool.py b/Lib/json/tests/test_tool.py
index 679ae83..b5d4fca 100644
--- a/Lib/json/tests/test_tool.py
+++ b/Lib/json/tests/test_tool.py
@@ -19,19 +19,19 @@
[
[
"blorpie"
- ],
+ ],
[
"whoops"
- ],
- [],
- "d-shtaeou",
- "d-nthiouh",
- "i-vhbjkhnth",
+ ],
+ [],
+ "d-shtaeou",
+ "d-nthiouh",
+ "i-vhbjkhnth",
{
"nifty": 87
- },
+ },
{
- "field": "yes",
+ "field": "yes",
"morefield": false
}
]
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index 9ec3440..fe47c52 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -31,7 +31,8 @@
except ValueError, e:
raise SystemExit(e)
with outfile:
- json.dump(obj, outfile, sort_keys=True, indent=4)
+ json.dump(obj, outfile, sort_keys=True,
+ indent=4, separators=(',', ': '))
outfile.write('\n')