Arduinojson V6 - ESP8266-12

Hi,

I changed the standard WifiManager lib example to fit the new ArduinoJson version but I just cannot solve the problem with the SPIFFS section. For some reason the, blynk_token 32 character code, gets truncated (the code only stores 31).

Any help is appreciated.

TIA

 //clean FS, for testing
  //SPIFFS.format();

  if (SPIFFS.begin()) {
    Serial.println("** Mounting file system **");
    if (SPIFFS.exists("/config.json")) {
      //file exists, reading and loading
      Serial.println("** Reading config file **");
      File configFile = SPIFFS.open("/config.json", "r");
      if (configFile) {
        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 doc(1024);
        DeserializationError error = deserializeJson(doc, buf.get());
        
        // Test if parsing succeeds.
        if (error) {
          Serial.print(F("deserializeJson() failed: "));
          Serial.println(error.c_str());
          return;
        }

        strcpy(mqtt_server, doc["mqtt_server"]);     //get the mqtt_server <== you need one of these for each param
        strcpy(mqtt_port, doc["mqtt_port"]);         //get the mqtt port
        strcpy(blynk_token, doc["blynk_token"]);     //get the blynk token

        Serial.println(blynk_token); //<-- missing last byte

      } else {
        Serial.println("** Failed to load json config **");
      }
      configFile.close();
      Serial.println("** Closed file **");
    }
  }
  else {
    Serial.println("** Failed to mount FS **");
  }