[SOLVED]Which is the right way to put a JSON string in a UDP packet?

I have read the wiki and searched in the posts, but I didn’t find a easy example for put a JSON string in a UDP outbound connection
I mixed a lot of solutions, but without success, someone could help me?

in the items file I put:

Switch button
String sendpg7 "[%s]"       { udp=">[192.168.0.106:5015:'REGEX(.*)']" }

in the sitemap

Switch item=button      label="UpdateUDP"       mappings=[ON="Now"]

in the rule

rule "Pg7 UDP publish"
when
    Item button received command
then
    // Build the command string
    val StringBuilder cmd = new StringBuilder
    cmd.append('{"page":7,"data":"2017-01-13T16:09:00Z"}')
    // Issue the command string to the socket
    sendpg7.postUpdate(cmd.toString)

end

If anyone recognizes parts of his code … sorry I read a lot and copied what I thought I had understood

I want to send a JSON {“page”:7,“data”:“2017-01-13T16:09:00Z”} to an wifi (esp8266) display:
with a python script with the same string the display works… decode data and time…

  • where is my error?
  • in which log I can find an error | confirm if I send a bad|right formatted packet??

thanks Ale

sorry!

I’m a stupid…
I put a comment in a line of my items.file… in the line previous “Switch button” …

but I used # instead of //

I read the openhab.log too late

sorry again