udpsend json terminator

Michael Carter's icon

Hey Y'all,

I'm trying to send JSON formatted messages over UDP to a computer running Touch Designer. The trouble I'm having is that he's expecting a terminator. So rather than getting this:
{ "console" : [ 0, 1, 2, 3 ] }
he wants to get this:
{ "console" : [ 0, 1, 2, 3 ] }/n

Does anyone know if there is a way to get the udpsend object to add terminators? Or can I add the terminator myself before the udpsend object? I tried using append and sprintf objects to add /n but the append object added a space which TD did not interpret as a terminator and the sprintf object caused errors from my udpsend object.

Thanks in advance for any help - Mike

udpJSON.maxpat
Max Patch

Michael Carter's icon

Sooooo, it looks like the udpsend object is tacking on terminators along with some additional info and what I was seeing in TD had been decoded. Here's what that message looks like before being decoded into a string:

b'{\n\t"console" : [ 0, 1, 2, 3 ]\n}\n\x00\x00\x00\x00,\x00\x00\x00'

Seems like we can parse this data with a python script in TD, though I'd def like to figure out how to get more control of how this data is being formatted by the udpsend object.