Closed
Description
Hi,
i have the following code:
`void read()
{
if (SPIFFS.begin())
{
if(SPIFFS.exists("/dev.json"))
{
File infoFile = SPIFFS.open("/dev.json", "r");
if(infoFile)
{
size_t size = infoFile.size();
std::unique_ptr<char[]> buf(new char[size]);
infoFile.readBytes(buf.get(), size);
DynamicJsonDocument jDoc(1500);
DeserializationError error = deserializeJson(jDoc,buf.get());
if(!error)
{
if(jDoc["GUID"]!=NULL)
{
String tempstr = jDoc["GUID"];
if(tempstr.startsWith("SECURED."))
{
tempstr.replace("SECURED.","");
jDoc["GUID"] = tempstr;
tempstr.toCharArray(GUID,80);
XORcrypt(GUID);
}
else
strcpy(GUID, jDoc["GUID"]);
}
}
}
}
}`
What i am facing now is that the condition if(jDoc["GUID"]!=NULL) is returning false, and when i pass jDoc["GUID"] to a string variable it has value! the property exists and has data. Why is it returning null? in another part of the code when i open other json files this condition works just fine, please help