You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After, i try to get the maxTempC value, but gives no value and when i put the line jDocLoad.containsKey("maxTempC") it returns FALSE, while the key and value is there which can be seen on the serializeJSonPretty.
What can be the problem?
The text was updated successfully, but these errors were encountered:
You can deserialize directly from a stream: DeserializationError err = deserializeJson(jDocLoad, cFile);
Less lines of code and less memory used...
What is your problem exactly ? If serializeJsonPretty returns the correct Json, than it means you have no error from deserializeJson and thus all is read fine from LittleFS. In that case, the problem is not in the code above. Or do I understand this wrong?
Hi,
I am facing a strange problem. I saved a JSON document into the ESP8266 file system.
Then i load it using this code:
` DynamicJsonDocument jDocLoad(1500);
DynamicJsonDocument jDoc(1500);
if (LittleFS.begin())
{
if (LittleFS.exists("/topRecordings.json"))
{
File cFile = LittleFS.open("/topRecordings.json", "r");
if (cFile)
{
size_t size = cFile.size();
// Allocate a buffer to store contents of the file.
std::unique_ptr<char[]> buf(new char[size]);
cFile.readBytes(buf.get(), size);
DeserializationError err = deserializeJson(jDocLoad,buf.get());
Serial.println(err.c_str());
serializeJsonPretty(jDocLoad,Serial);
}
cFile.close();
}`
The output of the serializeJsonPretty is this:
{
"maxTempC": 26.54,
"maxTempF": 79.772,
"maxTempTimeStampUTC": "2020-05-19T15:51:44",
"maxTempUNIXTime": 1589903504
}
After, i try to get the maxTempC value, but gives no value and when i put the line jDocLoad.containsKey("maxTempC") it returns FALSE, while the key and value is there which can be seen on the serializeJSonPretty.
What can be the problem?
The text was updated successfully, but these errors were encountered: