summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/raspberrypi/ctt/ctt_pretty_print_json.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py
index 9d450f6d..f1c61347 100644
--- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py
+++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py
@@ -16,16 +16,20 @@ class JSONPrettyPrinter(object):
"indent": 0,
"inarray": [False],
"arraycount": [],
- "skipnewline": True
+ "skipnewline": True,
+ "need_indent": False,
}
self.fout = fout
def newline(self):
self.fout.write('\n')
- self.fout.write(' ' * self.state["indent"] * 4)
+ self.state["need_indent"] = True
def write(self, c):
+ if self.state["need_indent"]:
+ self.fout.write(' ' * self.state["indent"] * 4)
+ self.state["need_indent"] = False
self.fout.write(c)
def process_char(self, c):