diff --git a/post_parser.py b/post_parser.py index 852c575..192cb1a 100644 --- a/post_parser.py +++ b/post_parser.py @@ -303,25 +303,9 @@ class PostParser: # Add raw JSON debug output if debug is enabled if debug: - try: - # Convert the message to a dictionary - message_dict = message.__dict__ - # Format JSON properly with indents - debug_json = json.dumps(message_dict, indent=4, ensure_ascii=False, default=str) - - # Create a div for JSON display with proper styling - json_lines = debug_json.split('\n') - json_html = [] - for line in json_lines: - # HTML escape each line individually - escaped_line = html.escape(line) - json_html.append(f'
{escaped_line}
') - - formatted_json = '\n'.join(json_html) - html_content.append(f'
{formatted_json}
') - except Exception as e: - html_content.append(f'
Error formatting JSON: {str(e)}
') - + debug_json = json.dumps(message, indent=2, ensure_ascii=False, default=str) + debug_json = debug_json.replace('\\n', '
').replace('\\"', '"') + html_content.append(f'
{debug_json}
') html_content = '\n'.join(html_content) return html_content