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
Hello,
what's the best way to check if a json property exists or has value ? i was trying to make the condition jDoc["relayInterval"]!=NULL but it's not working.
`
File configFile = SPIFFS.open("/configsa.json", "r");
size_t size = configFile.size();
// Allocate a buffer to store contents of the file.
std::unique_ptr<char[]> buf(new char[size]);
configFile.readBytes(buf.get(), size);
DynamicJsonDocument jDoc(2500);
DeserializationError error = deserializeJson(jDoc,buf.get());
if (!error)
{
if(jDoc["relayInterval"]!=NULL)
strcpy(relay_interval,jDoc["relayInterval"]);
}
'
The text was updated successfully, but these errors were encountered:
Hello,
what's the best way to check if a json property exists or has value ? i was trying to make the condition jDoc["relayInterval"]!=NULL but it's not working.
`
File configFile = SPIFFS.open("/configsa.json", "r");
size_t size = configFile.size();
// Allocate a buffer to store contents of the file.
std::unique_ptr<char[]> buf(new char[size]);
configFile.readBytes(buf.get(), size);
DynamicJsonDocument jDoc(2500);
DeserializationError error = deserializeJson(jDoc,buf.get());
if (!error)
{
if(jDoc["relayInterval"]!=NULL)
strcpy(relay_interval,jDoc["relayInterval"]);
}
'
The text was updated successfully, but these errors were encountered: