diff options
Diffstat (limited to 'utils/raspberrypi/ctt/ctt_pretty_print_json.py')
-rw-r--r-- | utils/raspberrypi/ctt/ctt_pretty_print_json.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index fac9e98b..73383ea0 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -4,6 +4,7 @@ # # ctt_pretty_print_json.py - camera tuning tool JSON formatter + """ takes a collapsed json file and makes it more readable """ @@ -11,10 +12,12 @@ def process_file(string, fout, state): for c in string: process_char(c, fout, state) + def print_newline(fout, state): fout.write('\n') fout.write(' '*state["indent"]*4) + def process_char(c, fout, state): if c == '{': if not state["skipnewline"]: @@ -61,6 +64,7 @@ def process_char(c, fout, state): fout.write(c) state["skipnewline"] = (c == '[') + def pretty_print_json(str_in, output_filename): state = {"indent": 0, "inarray": [False], "arraycount": [], "skipnewline": True} with open(output_filename, "w") as fout: |