Improve debug JSON output
This commit is contained in:
+4
-2
@@ -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'<pre class="debug-json" style="background: #f5f5f5; padding: 10px; margin-top: 20px; overflow-x: auto; font-size: 10px; white-space: pre-wrap;">{html.escape(debug_json)}</pre>')
|
||||
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'<pre class="debug-json" style="background: #f5f5f5; padding: 10px; margin-top: 20px; overflow-x: auto; font-size: 10px; white-space: pre-wrap;">{formatted_json}</pre>')
|
||||
|
||||
html_content = '\n'.join(html_content)
|
||||
return html_content
|
||||
|
||||
Reference in New Issue
Block a user