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