How to escape square bracket in rules

In my rule I try to send {“id”:1,“method”:“toggle”,“params”:[]} to my TCP helper item, the square brackets never got passed. I try to escape them using [ , \[, \u005B, but with no luck. on my sitemap, it just showed {“id”:1,“method”:“toggle”,“params”:}. Just wondering what is the right way to do this


String yhelper "command: [%s]"   {tcp=">[]" }

my rule

sendCommand( yhelper,  "{\"id\":2,\"method\":\"toggle\",\"params\": [] }" )

In JSON, [] means “array”. If you want a string that is [], then specify a string like "[]".

what I want to send is exactly that json with an empty array for “params”

Sorry I didn’t read more carefully. Your literal string "{\"id\":2,\"method\":\"toggle\",\"params\": [] }" ought to have worked. Could you verify in your events.log that the square brackets weren’t sent, as opposed to an issue with the user interface not showing them?

Sorry for the late reply. I double checked the log file, the square brackets did send. I was the user interface didn’t have them displayed.

Thanks for the reply! If you wouldn’t mind opening an issue against the UI(s) that stripped off the square brackets, it would be helpful. Thanks in any case for posting back here.