From e101c78e03b03c4e66098a5e115788062fc51e4c Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 3 Jul 2020 01:43:57 +0300 Subject: utils: raspberrypi: ctt: json_pretty_print: Skip all spaces Skip all white space characters, not just ' '. This makes a difference if the input JSON data is already formatted. Signed-off-by: Laurent Pinchart Reviewed-by: David Plowman Tested-by: David Plowman --- utils/raspberrypi/ctt/ctt_pretty_print_json.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index 3de8c108..dfa99a6d 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -52,8 +52,6 @@ class JSONPrettyPrinter(object): elif c == ':': self.fout.write(c) self.fout.write(' ') - elif c == ' ': - pass elif c == ',': if not self.state["inarray"][0]: self.fout.write(c) @@ -67,6 +65,8 @@ class JSONPrettyPrinter(object): self.newline() else: self.fout.write(' ') + elif c.isspace(): + pass else: self.fout.write(c) self.state["skipnewline"] = (c == '[') -- cgit v1.2.1