title: How to create JSON using MQTT javascript?
body: <p>I am trying to publish few real time values using MQTT javascript. Here below I need set proper JSON format values.
  Here I can send only one value for all buses but I need to send Seperate buses seperate values. How to do that.</p>
  
  <p><strong>My Current Code:</strong></p>
  
  <pre><code>var data = {
      Buses: "BusA", "BusB", "BusC",
      Speed: BusA_minspeed + (BusA_maxspeed - BusA_minspeed) * Math.random(), // It should be use seperate values seperate Buses
      FL: BusA_minfl + (BusA_maxfl - BusA_minfl) * Math.random()
  };
  </code></pre>
  
  <p><strong>My Expectations:</strong></p>
  
  <pre><code>Buses  Speed FL
  BusA    123  80
  BusB    231  40
  BusC    124  50
  </code></pre>
  
  <p><strong>My Publishing Part</strong></p>
  
  <pre><code>function publishTelemetry() {
      data.Speed = genNextValue(data.Speed, BusA_minspeed, BusA_maxspeed);
      data.FL = genNextValue(data.Fl, BusA_minfl, BusA_maxfl);
      client.publish('v1/devices/me/telemetry', JSON.stringify(data));
  }
  
  function genNextValue(prevValue, min, max) {
      var value = prevValue + ((max - min) * (Math.random() - 0.5)) * 0.03;
      value = Math.max(min, Math.min(max, value));
      return Math.round(value * 10) / 10;
  }
  </code></pre>