diff --git a/scripts/jsonl_pretty_print.py b/scripts/jsonl_pretty_print.py index d8332ed..214b88d 100644 --- a/scripts/jsonl_pretty_print.py +++ b/scripts/jsonl_pretty_print.py @@ -50,9 +50,12 @@ def pretty_print_jsonl(path: Path, indent: int) -> None: obj = json.loads(line) except json.JSONDecodeError as exc: sys.exit(f"JSON decode error on line {idx}: {exc}") # fail fast - # Dump the pretty JSON followed by a newline separator - print(json.dumps(obj, indent=indent, ensure_ascii=False, sort_keys=True)) - print() # blank line between records for readability + # Build pretty JSON string, convert literal "\n" sequences to real newlines, + # and emit a blank line between records for readability. + pretty = json.dumps(obj, indent=indent, ensure_ascii=False, sort_keys=True) + pretty = pretty.replace("\\n", "\n") + sys.stdout.write(pretty) + sys.stdout.write("\n\n") def main() -> None: