I am trying to access a nested JSON object, but I am getting Cannot read property 'module' of undefined.
Here is the JSON file.
{
"server": {
"module": {
"InPluginPath": "/usr/home/nah/Website/server/httpModule.js"
}
}
}
Then when I try to access the JSON object after reading the file with fs.readFile(), I get the Cannot read property 'module' of undefined, error. Below is the line that causes the error.
console.log(config.server.module.InPluginPath);
fs.readFile(). Do you know thatrequire()will load and parse a .json file for you automatically.