Push json object to MQTT broker

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
Add a Script, and this is added to the bottom

	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)