Non-json data from serial bridge not escaped in SerialReceived string value #8329
Closed
12 of 15 tasks
Labels
troubleshooting
Type - Troubleshooting
PROBLEM DESCRIPTION
When receiving text from a serial input using the serial bridge (not
serial_bridge_raw
), it is copied 1:1 into the string value of theSerialReceived
property when generating the output message (the data from serial is not json itself in this case, so it doesn't begin with a{
).When the text contains a
\
(or one of the other forbidden chars in json, like"
or some control characters) this is not properly escaped in the resulting json message, causing invalid json that can be an issue for the consuming systems.Sample input from serial:
/ISK5\2M550E-1011
Resulting message:
{"SerialReceived":"/ISK5\2M550E-1011"}
Should be:
{"SerialReceived":"/ISK5\\2M550E-1011"}
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:(Please use
weblog 4
for more debug information)TO REPRODUCE
Steps to reproduce the behavior:
\
\
and report a general error about it not being a recognized type)EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
When non-json data from serial contains one of the forbidden characters (list can be found in ECMA-404 section 9), escape them so the resulting message contains valid json.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: