Reading file from SPIFFS in nodemcu using ArduinoJson #include &lt;ArduinoJson.h&gt;      
#include &lt;FS.h&gt;    

/* Set these to desired credentials in runtime */
struct Config {
  String ssid = "";
  String pass = "";
  bool hFlag = false;
};

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("");
  delay(1000);

  //allows serving of files from SPIFFS
  Serial.println("Mounting FS...");
  if (!SPIFFS.begin()) {
    Serial.println("Failed to mount file system");
    return;
  }

  if (readConfigFile("/LaSt.json", false)) {
    Serial.println("Config read");
  } else {
    Serial.println("Failed to read config");
  }
}

bool readConfigFile(char* fileName, bool whichFile)
{
  File configFile = SPIFFS.open(fileName, "r");
  if (!configFile) {
    Serial.println("Failed to open config file");
    return false;
  }

  size_t size = configFile.size();
  if (size &gt; 1024) {
    Serial.println("Config file size is too large");
    return false;
  }

  // Allocate the memory pool on the stack.
  // Use arduinojson.org/assistant to compute the capacity.
  StaticJsonBuffer&lt;256&gt; jsonBuffer;

  // Parse the root object
  JsonObject &amp;root = jsonBuffer.parseObject(configFile);

  if (!root.success())
    Serial.println(F("Failed to read file, using default configuration"));

  // Copy values from the JsonObject to the Config
  Config.ssid = root["ssid"];
  Config.pass = root["pass"];
  if (whichFile)
  {
    Config.hFlag = root["hFlag"];
  }

  // We don't need the file anymore
  configFile.close();

  return true;
}


Compile gives error in Copy values from the JsonObject to the Config section. Error: expected unqualified-id before '.' token.

Want to read file from SPIFFS, and store in variable to use.
Your code at the top:

struct Config {
  String ssid = "";
  String pass = "";
  bool hFlag = false;
};


defines a variable "type". It's like making a new int or bool, but yours is called struct Config. 

After making the type, you need to create declare an instance of it.

struct Config cfg;


Then, you refer to the one you created:

  // Copy values from the JsonObject to the Config struct named cfg
  cfg.ssid = root["ssid"];
  cfg.pass = root["pass"];
  if (whichFile)
  {
    cfg.hFlag = root["hFlag"];
  }


Note that a particular issue with ArduinoJSON and Strings is that you may get an error like:

error: ambiguous overload for 'operator=' (operand types are 'String' and 'ArduinoJson::JsonObjectSubscript&lt;const char*&gt;')


There is an ArduinoJSON FAQ entry that states


  Most of the time you can rely on implicit casts.
  
  But there is one notable exception: when you convert a JsonVariant to
  a String.
  
  For example:

String ssid = network["ssid"];
ssid = network["ssid"];

  
  The first line will compile but the second will fail with the
  following error:

error: ambiguous overload for 'operator=' (operand types are 'String' and 'ArduinoJson::JsonObjectSubscript&lt;const char*&gt;')

  
  The solution is to remove the ambiguity with any of the following replacement:

ssid = (const char*)network["ssid"];
ssid = network["ssid"].as&lt;const char*&gt;();
ssid = network["ssid"].as&lt;String&gt;();