summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-03 01:43:57 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-03 18:15:42 +0300
commite101c78e03b03c4e66098a5e115788062fc51e4c (patch)
treea2412171db25c85f1a923a4ebe37066fe030600f
parent5224f471ca93ffc2c7a45fa05f5b0177dc48034e (diff)
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com>
-rw-r--r--utils/raspberrypi/ctt/ctt_pretty_print_json.py4
1 files changed, 2 insertions, 2 deletions
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 == '[')