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>
This commit is contained in:
Laurent Pinchart 2020-07-03 01:43:57 +03:00
parent 5224f471ca
commit e101c78e03

View file

@ -52,8 +52,6 @@ class JSONPrettyPrinter(object):
elif c == ':': elif c == ':':
self.fout.write(c) self.fout.write(c)
self.fout.write(' ') self.fout.write(' ')
elif c == ' ':
pass
elif c == ',': elif c == ',':
if not self.state["inarray"][0]: if not self.state["inarray"][0]:
self.fout.write(c) self.fout.write(c)
@ -67,6 +65,8 @@ class JSONPrettyPrinter(object):
self.newline() self.newline()
else: else:
self.fout.write(' ') self.fout.write(' ')
elif c.isspace():
pass
else: else:
self.fout.write(c) self.fout.write(c)
self.state["skipnewline"] = (c == '[') self.state["skipnewline"] = (c == '[')