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:
parent
5224f471ca
commit
e101c78e03
1 changed files with 2 additions and 2 deletions
|
@ -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 == '[')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue