title: How to publish json data on mqtt broker in python?
body: <p>I am trying to publish JSON data on MQTT broker topic. this is the source code, I tried-</p>
  
  <pre><code>import paho.mqtt.client as mqtt
  import json
  # Define Variables
  MQTT_HOST = "localhost"
  MQTT_PORT = 1883
  MQTT_KEEPALIVE_INTERVAL = 45
  MQTT_TOPIC = "irisPayload"
  
  MQTT_MSG=json.dumps({"sepalLength": "6.4","sepalWidth":  "3.2","petalLength": "4.5","petalWidth":  "1.5"});
  # Define on_publish event function
  def on_publish(client, userdata, mid):
      print "Message Published..."
  # Initiate MQTT Client
  mqttc = mqtt.Client()
  
  # Register publish callback function
  mqttc.on_publish = on_publish
  
  # Connect with MQTT Broker
  mqttc.connect(MQTT_HOST, MQTT_PORT, MQTT_KEEPALIVE_INTERVAL)        
  
  # Publish message to MQTT Broker    
  mqttc.publish(MQTT_TOPIC,MQTT_MSG)
  
  # Disconnect from MQTT_Broker
  mqttc.disconnect()
  </code></pre>
  
  <p>I just want to publish JSON data without payload={jsondata}format, how to remove payload as it comes every time when I am publishing my data on particular topic?</p>
  
  <p>In the log it shows msg like this--- [payload={ "sepalLength": "6.4", "sepalWidth": "3.2", "petalLength": "4.5", "petalWidth": "1.5" }] </p>