The send device command box in device debug screen /applications/
app-id/devices/
device-id/debug
is currently only capable of sending string payloads.
Even if I enter a JSON payload,
it is sent as string:
This leads to difficulty in debugging an Arduino firmware that processes commands, because the MQTT library assumes payload is always a JSON object.
I’d suggest an option in send device command box. Specifically, a row of radio buttons should be added under payload textarea:
Payload type (*) auto detect ( ) JSON ( ) string
The default selection is auto detect, which would send the payload as JSON if it parses as valid JSON, and send the payload as string otherwise. When the payload textarea loses focus, the text “auto detect” becomes either “auto detect (JSON)” or “auto detect (string)” to reflect what’s detected. If user selects “JSON”, the “send command” button should be disabled until the payload is valid JSON. If user selects “string”, JSON syntax highlighting should be deactivated.