MQTT JSON Message Formatting Assistance

Hello everyone, I’m currently working on setting up an MQTT message for my smart devices and I need a bit of help with the JSON formatting. My goal is to send a message in the following structure:

{
“1”: [{ “state”: “OFF” }],
“2”: [{ “state”: “OFF” }],
“3”: [{ “state”: “OFF” }],
“4”: [{ “state”: “OFF” }]
}

I’ve tried configuring my switches with the following settings:

plaintext
Type switch : switch_wateringrelayone “control watering relay 1” [stateTopic=“Watering/relays/sensor”, commandTopic=“Watering/relays”, transformationPattern=“JSONPATH:$[“1”][0].state”, transformationPatternOut=“JSONPATH:$[“1”][0].state”, on=“ON”, off=“OFF”]

The state messages are transforming correctly, but I’m struggling with the command messages. Is there a way to ensure the command messages follow the same JSON structure? I’ve heard about using transformation modes, but I’m not entirely sure how to apply them here. Any advice or examples would be greatly appreciated! I’m excited to get this working and would love to share my solution once I figure it out. Thanks in advance for your help!