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