How to encode a JSON packet like {"id":{"noData":True}} (Sigfox downlink type)

I want to encode the downlink packet of a Sigfox device.
Two type of packets can be sent:

response={"21f400":{"noData":True}}
response={"21f400":{"downlinkData":"dadadadadadadada"}}

I have done it before in python this way, and it worked fine:

		response={device:{"noData":True}}
		response=json.dumps(response)

In node- red I have tried different options , the last:
msg.payload={deviceId:{"noData":true}}
But It doesn't work.

Any other ideas? Thanks!

If you do that and return the message and send to a debug node what do you see?

Hi Colin and thanks.

Debug node shows:
packetType : msg.payload : Object

object

deviceId: object

downlinkData: "0201020000000000"

I clarify that deviceId is defined in the node as:
var deviceId = flow.get('deviceId')

I can't see how you get that from
msg.payload = {deviceId:{"noData":true"}}
I think I am missing something about what you are doing.
Explain again exactly what you are trying to get in the payload, with an example.

Ah, I think I see a bit of what you are trying to do, if you want
msg.payload={"21f400":{"noData":True}}
where you already have something like
deviceID = "21f400"
Then you can say

msg.payload = {}
msg.payload[deviceID] = {noData: true}

Thank you!!

That worked, finally!