user60266: I am trying to publish JSON data to mqtt with following code snippet 
#include <Arduino_JSON.h>
JSONVar data;
data["temperature"] = temperature;
data["humidity"] = humidity;
data["pressure"] = pressure;
data["chipId"] = chipId;

String jsonString = JSON.stringify(data);
client.publish("esp32/data", jsonString);

But getting following error 
/home/ubuntu/Arduino/libraries/PubSubClient/src/PubSubClient.h:144:12: note:   candidate expects 4 arguments, 2 provided
Multiple libraries were found for "PubSubClient.h"
 Used: /home/ubuntu/Arduino/libraries/PubSubClient
Multiple libraries were found for "Wire.h"
 Used: /home/ubuntu/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/Wire
Multiple libraries were found for "Adafruit_BME280.h"
 Used: /home/ubuntu/Arduino/libraries/Adafruit_BME280_Library
Multiple libraries were found for "Adafruit_Sensor.h"
 Used: /home/ubuntu/Arduino/libraries/Adafruit_Unified_Sensor
Multiple libraries were found for "SPI.h"
 Used: /home/ubuntu/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/SPI
Multiple libraries were found for "Arduino_JSON.h"
 Used: /home/ubuntu/Arduino/libraries/Arduino_JSON
Multiple libraries were found for "WiFi.h"
 Used: /home/ubuntu/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
 Not used: /opt/arduino-1.8.10/libraries/WiFi
exit status 1
no matching function for call to 'PubSubClient::publish(const char [11], String&)'

Whats is wrong here ?

user46852: What's your last error message?
no matching function for call to 'PubSubClient::publish(const char [11], String&)'

Read the documentation for the publish() method in PubSubClient:

int publish (topic, payload)
Publishes a string message to the specified topic.
Parameters
topic - the topic to publish to (const char[]) 
payload - the message to publish (const char[])

Look at the parameters you're using. You're passing a String as payload. publish() expects payload to be a char[] (essentially the same thing as a char*) - a C language string. This is the error you're seeing.
Read the documentation for String. How do you get a char* from a String? The c_str() method.
You need to change
client.publish("esp32/data", jsonString);

to
client.publish("esp32/data", jsonString.c_str());

As for your other warnings, it looks like your Arduino libraries are a mess with multiple conflicting libraries installed; if you want to get rid of the warnings, clean up your libraries.

60266: <p>I am trying to publish <code>JSON</code> data to mqtt with following code snippet </p>

<pre><code>#include &lt;Arduino_JSON.h&gt;
JSONVar data;
data["temperature"] = temperature;
data["humidity"] = humidity;
data["pressure"] = pressure;
data["chipId"] = chipId;

String jsonString = JSON.stringify(data);
client.publish("esp32/data", jsonString);
</code></pre>

<p>But getting following error </p>

<pre><code>/home/ubuntu/Arduino/libraries/PubSubClient/src/PubSubClient.h:144:12: note:   candidate expects 4 arguments, 2 provided
Multiple libraries were found for "PubSubClient.h"
 Used: /home/ubuntu/Arduino/libraries/PubSubClient
Multiple libraries were found for "Wire.h"
 Used: /home/ubuntu/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/Wire
Multiple libraries were found for "Adafruit_BME280.h"
 Used: /home/ubuntu/Arduino/libraries/Adafruit_BME280_Library
Multiple libraries were found for "Adafruit_Sensor.h"
 Used: /home/ubuntu/Arduino/libraries/Adafruit_Unified_Sensor
Multiple libraries were found for "SPI.h"
 Used: /home/ubuntu/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/SPI
Multiple libraries were found for "Arduino_JSON.h"
 Used: /home/ubuntu/Arduino/libraries/Arduino_JSON
Multiple libraries were found for "WiFi.h"
 Used: /home/ubuntu/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
 Not used: /opt/arduino-1.8.10/libraries/WiFi
exit status 1
no matching function for call to 'PubSubClient::publish(const char [11], String&amp;)'
</code></pre>

<p>Whats is wrong here ?</p>
 46852: <p>What's your last error message?</p>

<pre><code>no matching function for call to 'PubSubClient::publish(const char [11], String&amp;)'
</code></pre>

<p><a href="https://pubsubclient.knolleary.net/api.html#publish1" rel="nofollow noreferrer">Read the documentation</a> for the <code>publish()</code> method in <code>PubSubClient</code>:</p>

<blockquote>
  <p>int publish (topic, payload)</p>
  
  <p>Publishes a string message to the specified topic.</p>
  
  <p>Parameters</p>
  
  <p>topic - the topic to publish to (const char[]) </p>
  
  <p>payload - the message to publish (const char[])</p>
</blockquote>

<p>Look at the parameters you're using. You're passing a <code>String</code> as <code>payload</code>. <code>publish()</code> expects <code>payload</code> to be a <code>char[]</code> (essentially the same thing as a <code>char*</code>) - a C language string. This is the error you're seeing.</p>

<p><a href="https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/" rel="nofollow noreferrer">Read the documentation</a> for <code>String</code>. How do you get a <code>char*</code> from a <code>String</code>? The <code>c_str()</code> method.</p>

<p>You need to change</p>

<pre><code>client.publish("esp32/data", jsonString);
</code></pre>

<p>to</p>

<pre><code>client.publish("esp32/data", jsonString.c_str());
</code></pre>

<p>As for your other warnings, it looks like your Arduino libraries are a mess with multiple conflicting libraries installed; if you want to get rid of the warnings, clean up your libraries.</p>
