Facing problem using json

dear all.

i am facing below error when ever i tried to upload code to esp8266. please i need your kind suggestions. thanks in advance.

odeForMcu:59:46: error: no matching function for call to 'ArduinoJson::StaticJsonBuffer<1000u>::parseObject(SoftwareSerial&)'

JsonObject& root = jsonBuffer.parseObject(s);

It seems to be telling you that there is no function in your library that can be called like that.

I don't know the library, but a quick google search shows that working directly with JsonBuffer was changed from their version 6 for a more streamlined solution. So maybe the problem is that you updated your libraries but still work with old code?

Also, what is this "s" you're feeding the function? Actually posting the code along with the error messages would help.

// Code for Node MCU only //
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
/************************* WiFi Access Point /
#define WLAN_SSID "
"
#define WLAN_PASS "
"
/
************ Adafruit.io Setup /
#define AIO_SERVER "io.adafruit.com"
#define AIO_SERVERPORT 1883
#define AIO_USERNAME "
"
#define AIO_KEY "
**"

WiFiClient client;

Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/voltage");
Adafruit_MQTT_Publish photocel2 = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/current");
Adafruit_MQTT_Publish photocel3 = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/Kwh");
Adafruit_MQTT_Publish photocel4 = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/watt");

void MQTT_connect();

#include <SoftwareSerial.h>
SoftwareSerial s(D4, D3);
#include <ArduinoJson.h>

void setup()

{
Serial.begin(115200);
delay(10);
Serial.println(F("Solar Power Monitoring"));
// Connect to WiFi access point.
Serial.println(); Serial.println();
Serial.print("Connecting to ");
Serial.println(WLAN_SSID);
WiFi.begin(WLAN_SSID, WLAN_PASS);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected");
Serial.println("IP address: "); Serial.println(WiFi.localIP());
// Setup MQTT subscription for onoff feed.
//mqtt.subscribe(&onoffbutton);
s.begin(9600); while (!Serial) continue;
}

uint32_t x = 0;
void loop()
{
StaticJsonBuffer<1000> jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(s);
if (root == JsonObject::invalid()) return;
delay(0);
Serial.println("IOT based sun tracking Solar Monitoring station");
root.prettyPrintTo(Serial);
Serial.print("voltage");
int voltage = root["voltage"];
Serial.print(voltage);
Serial.print("Amps");
int Amps = root["Amps"];
Serial.print(Amps);
Serial.print("Kwh");
int Kwh = root["Kwh"];
Serial.print(Kwh);
Serial.print("watt");
int watt = root["watt"];
Serial.print(watt);
{
Serial.println("");
Serial.println("---------------------xxxxx--------------------");
}
// function definition further below.
MQTT_connect();
// this is our 'wait for incoming subscription packets' busy subloop
// try to spend your time her
// Now we can publish stuff!
Serial.println(F("\nSolar monitoring... "));

if (! photocell.publish(voltage))
{
Serial.println(F("Failed"));
} else
{
Serial.println(F("OK!"));
}
if (! photocel2.publish(Amps))
{
Serial.println(F("Failed"));
} else
{
Serial.println(F("OK!"));
}
if (! photocel3.publish(Kwh))
{
Serial.println(F("Failed"));
} else
{
Serial.println(F("OK!"));
}
if (! photocel4.publish(watt))

{
Serial.println(F("Failed"));
} else
{
Serial.println(F("OK!"));
}

// ping the server to keep the mqtt connection alive
// NOT required if you are publishing once every KEEPALIVE seconds
/*
if(! mqtt.ping()) {
mqtt.disconnect();
}
*/
}

// Function to connect and reconnect as necessary to the MQTT server.
// Should be called in the loop function and it will take care if connecting.
void MQTT_connect() {
int8_t ret;

// Stop if already connected.
if (mqtt.connected()) {
return;
}

Serial.println("Connecting to Adafruit... ");

uint8_t retries = 3;
while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
Serial.println(mqtt.connectErrorString(ret));
Serial.println("Retrying MQTT connection in 5 seconds...");
mqtt.disconnect();
delay(5000); // wait 5 seconds
retries--;
if (retries == 0) {
// basically die and wait for WDT to reset me
while (1);
}
}
Serial.println("Adafruit Connected!");
}

So... First, it's better to post your code preformatted. Use the </> button in the post box. Makes it look like it looks in the IDE. Second, what did you find after considering my other remarks?

ArduinoJson does not look like the easiest thing to work with, but this from one of the examples, client looks like it is a Stream

 DynamicJsonDocument doc(capacity);
  // Parse JSON object
  DeserializationError error = deserializeJson(doc, client);

The project Arduino to Arduino via Serial has an example using json

Some users have reported problems using the ArduinoJson library not releasing memory. The current example, from the link above, failed if the Json object was create in the loop() code instead of as a global. The code here runs reliably but if you run into problems you could look at an alternative Json libraries like jRead and it companion jWrite which work on a fixed buffer.

Hi @amjo .
Which version of the json library did you install,
V5 or V6?

RV mineirin