code: public static void publish(MqttSettings settings, String subtopic, Object data) throws JsonProcessingException, MqttException {
      ObjectMapper objectMapper = new ObjectMapper();
      publish(settings, subtopic, objectMapper.writeValueAsBytes(data), 1, false);
    }
docs: Publishes data as JSON string into given topic
  
  @param settings MQTT settings
  @param subtopic subtopic to deliver the message to.
  @param data data to be send
  @throws JsonProcessingException thrown when data serialization fails
  @throws MqttException thrown when MQTT client construction fails