Payload message size in bytes

Hi
is there a way to see the payload (JSON) message size in bytes using node-red ?

Thanks

Is the payload a string or what? You said JSON but JSON format implies it is a string. Perhaps you actually mean it is a javascript object in which case I suspect the answer is 'not easily' if not 'no'.
If you don't know what it is then feed it into a debug node and show us what it says.

[Edit] Plus you have asked for payload message size, but the payload is not a message. Did you mean message.payload size or do you mean the size of a message containing this payload, or perhaps something else?

Hi colin, sorry maybe was not clear...I am using the watson iot node and I am receiving messages from the platform. the message is a json payload that I wish to monitor the size in bytes (probably using a function).
this is an example of the payload that I see in the debug window:

msg.payload : Object

object

camera_congelado: 28.2

camera_fria_umidade: 62.5

camera_fria: 28.2

date: "2019-03-08 19:40:06.933612"

tempo_total: 0

count_porta: 0

rendimento: 0

porta: true

camera_congelado_umidade: 62.5

fail: false

local: "17784"

tempo_porta: 87

As Colin indicated trying to define the length of an object is a bit tricky. But you would get an indication by taking a string version of the object, e.g.

msg.payload = JSON.stringify(msg.payload).length;

This would include any necessary escape characters and quotes so is the same as the length of the object per se - but may be good enough ?

excellent!

it worked...that is exactly what I was looking for!

thank you all!