# Push json object to MQTT broker

**URL:** <https://forum.inductiveautomation.com/t/push-json-object-to-mqtt-broker/54284>\
**Category:** Maker\
**Created:** [December 19, 2021, 6:45pm UTC](https://forum.inductiveautomation.com/t/push-json-object-to-mqtt-broker/54284 "2021-12-19T18:45:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nate\_Damm](https://avatars.discourse-cdn.com/v4/letter/n/9dc877/32.png) [@Nate\_Damm](https://forum.inductiveautomation.com/u/Nate_Damm)\
**Post date:** [December 19, 2021, 6:45pm UTC](https://forum.inductiveautomation.com/t/push-json-object-to-mqtt-broker/54284/1 "2021-12-19T18:45:22Z")

</div>

I struggled for awhile to figure out how to push a Json object out from a button press from perspective to my MQTT broker, so here is my solution if it can help anyone else.  
Please let me know if my method could be simpler, or if this is explained somewhere else google has failed to show me.

Right click on the button  
Event Configuration  
Mouse Events  
onClick\*  
Add a Script, and this is added to the bottom

```auto
	timer = self.getSibling("timer").props.value
	tag = self.meta.tag
	push = self.meta.bool

	msg = {"ctrl":"ignition","timer":timer, "cmd":push}
	json = system.util.jsonEncode(msg)

	topic = "house_control/cmd/door/"+ tag

	system.cirruslink.engine.publish("MQTT_BROKER", topic, str(json).encode(), 0, 0)

```
