Skip to content

Fix invalid JSON in receipt print response#82

Open
Igglybuff wants to merge 1 commit into
eljojo:mainfrom
Igglybuff:fix/receipt-json-response
Open

Fix invalid JSON in receipt print response#82
Igglybuff wants to merge 1 commit into
eljojo:mainfrom
Igglybuff:fix/receipt-json-response

Conversation

@Igglybuff

Copy link
Copy Markdown

The success_response and error_response functions were building JSON via string interpolation. When a title was provided, the format string wrapped it in literal " characters which were then embedded directly into the JSON string value, producing invalid JSON:

{"success": true, "message": "Receipt "My Title" printed successfully"}

The no-title branch happened to produce valid JSON, so the bug only manifested when a title was actually supplied.

Fix: switch both functions to axum::Json with serde-derived structs so serialization is always correct regardless of input.

🤖 Generated with Claude Code

success_response and error_response were building JSON via string
interpolation. A title containing any characters (particularly the
wrapping quotes added by the format string) produced malformed JSON
that browsers couldn't parse.

Switch both functions to use axum::Json with serde-derived structs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant