From dc4af5aa863ef8467fc7fb6f64ad6b6056132a9b Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Mon, 24 Mar 2025 16:45:31 +0300 Subject: [PATCH] Improve debug JSON output --- post_parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/post_parser.py b/post_parser.py index 3158dc9..a119a6c 100644 --- a/post_parser.py +++ b/post_parser.py @@ -301,8 +301,10 @@ class PostParser: # Add raw JSON debug output if debug is enabled if debug: debug_message = copy.deepcopy(message) - debug_json = json.dumps(debug_message, default=str, indent=2, ensure_ascii=False) - html_content.append(f'
{html.escape(debug_json)}
') + debug_json = json.dumps(debug_message, default=str, ensure_ascii=False) + # Format JSON by replacing braces with newlines + formatted_json = debug_json.replace('{', '{\n').replace('}', '\n}').replace(',', ',\n') + html_content.append(f'
{formatted_json}
') html_content = '\n'.join(html_content) return html_content