Improve JSON output formatting in web UI#419
Conversation
Co-authored-by: cschleiden <2201819+cschleiden@users.noreply.github.com>
Co-authored-by: cschleiden <2201819+cschleiden@users.noreply.github.com>
cschleiden
left a comment
There was a problem hiding this comment.
@copilot provide another screenshot of the "after" state. Scroll down a bit so the inputs are visible
Here's another screenshot of the "after" state showing the inputs section with the improved JSON formatting: This shows the Input section displaying |
|
@copilot Can you add a screenshot of the history as well? Showing a more complex input than just a single number |
Here's a screenshot of the history section showing complex input formatting. This demonstrates the JSON formatting improvements with: Input section showing:
History section (WorkflowExecutionStarted event) showing:
|
|
@copilot the screenshot does not show up, try again |
Here's a screenshot showing the complex inputs and history with properly formatted JSON: This demonstrates the JSON formatting improvements with: Input section showing:
History section (WorkflowExecutionStarted event) showing:
|
|
@copilot Add the screenshots to the PR description |
I've updated the PR description to include the additional screenshots. The description now shows:
The PR description now provides a comprehensive visual comparison of the improvements made to JSON formatting in the web UI. |


The web UI was displaying JSON inputs and outputs as escaped strings with backslashes instead of properly formatted JSON objects, making them difficult to read and debug.
Before:
The input section showed compact escaped JSON like
{"Msg":"","Times":2}and the attributes section displayed complex escaped strings with backslashes:After:
JSON objects are now properly formatted with indentation and spacing. The same input now displays as
{ "Msg": "", "Times": 2 }and attributes show clean, readable JSON:Changes Made
decodePayloadfunction: Now detects valid JSON strings and pretty-prints them with proper indentation while leaving non-JSON content unchangedformatAttributesForDisplayfunction: Handles the attributes section to avoid double-escaping issues that were causing the backslash-heavy displayInstance.tsx: Uses the new formatting function for event attributes displayBenefits
The solution follows the approach suggested in the issue description - attempting to parse each string as JSON and pretty-printing it if valid, while leaving non-JSON content unchanged to handle custom converters gracefully.
Fixes #338.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.