Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Issues
  • #998
Closed
Open
Issue created May 19, 2019 by Administrator@rootContributor

jSonDocument property: sometimes null, sometimes not!

Created by: vaz83

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

Assignee
Assign to
Time tracking