From d9443b8a543ca4a77d122f99f642a0756780f8e8 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Mon, 24 Mar 2025 16:54:45 +0300 Subject: [PATCH] Refactor debug JSON --- post_parser.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/post_parser.py b/post_parser.py index 4bbd430..fba6aca 100644 --- a/post_parser.py +++ b/post_parser.py @@ -303,12 +303,8 @@ 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, 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}
') - + debug_json = json.dumps(message, indent=2, ensure_ascii=False, default=str) + html_content.append(f'
{html.escape(debug_json)}
') html_content = '\n'.join(html_content) return html_content