From 5ef339d7a56aee32aec0f563242502540639a876 Mon Sep 17 00:00:00 2001 From: Mike Gerber Date: Fri, 28 Mar 2014 15:43:11 +0100 Subject: [PATCH] Avoid trailing whitespace in the JSON output The default separators used in the Python JSON library's dump() write output with trailing whitespace. Use custom separators to avoid that, as described in the documentation: http://docs.python.org/2/library/json.html --- sloth/annotations/container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sloth/annotations/container.py b/sloth/annotations/container.py index da423f5..43f7938 100644 --- a/sloth/annotations/container.py +++ b/sloth/annotations/container.py @@ -314,7 +314,7 @@ class JsonContainer(AnnotationContainer): """ # TODO make all image filenames relative to the label file f = open(fname, "w") - json.dump(annotations, f, indent=4, sort_keys=True) + json.dump(annotations, f, indent=4, separators=(',', ': '), sort_keys=True) class YamlContainer(AnnotationContainer):