Passing a variable in the require in javascript
<p>I'm using javascript and node.js . I have the following lines in my code :</p>

<pre><code>var countryName = "Turkey";
var jsonPath = '../'+countryName+'/PersonalDetails.json';
console.log(jsonPath);
var PersonalDetails = require(jsonPath);
</code></pre>

<p>This gives the error : Cannot find module '../Turkey/PersonalDetails.json'</p>

<p>but when I use  </p>

<pre><code>var PersonalDetails = require('../Turkey/PersonalDetails.json'); 
</code></pre>

<p>it works fine. What am I missing?</p>

<p>Also attaching my json file for reference.</p>

<pre><code>{
    "fields":[
                {
                    "fieldType":"Radio",
                    "fieldLabel":"Relevance to the transaction :",
                    "disclosureField":""    ,
                    "fieldList":["One carrying out the transaction","One on behalf of him/her the transaction is carried out","Indirect Relevance"]
                },
                {
                    "fieldType":"Radio",
                    "fieldLabel":"Is ID Card False",
                    "disclosureField":"",
                    "fieldList":["Yes","No"]
                },
                {
                    "fieldType":"Radio",
                    "fieldLabel":"Sex :",
                    "disclosureField":"gender",
                    "fieldList":["Male","Female","Unknown"]
                },
                {
                    "fieldType":"TextInput",
                    "fieldLabel":"First Name",
                    "disclosureField":"identity.first_name",
                    "fieldList":[]
                },
                {
                    "fieldType":"TextInput",
                    "fieldLabel":"SurName",
                    "disclosureField":"identity.last_name",
                    "fieldList":[]
                },
                {
                    "fieldType":"NumberInput",
                    "fieldLabel":"TR ID Number :",
                    "disclosureField":"",
                    "fieldList":[]
                },
                {
                    "fieldType":"NumberInput",
                    "fieldLabel":"Tax Number :",
                    "disclosureField":"",
                    "fieldList":[]
                },
                {
                    "fieldType":"TextInput",
                    "fieldLabel":"Mother's Name :",
                    "disclosureField":"",
                    "fieldList":[]
                },
                {
                    "fieldType":"TextInput",
                    "fieldLabel":"Father's Name :",
                    "disclosureField":"",
                    "fieldList":[]
                },
                {
                    "fieldType":"TextInput",
                    "fieldLabel":"Nationality :",
                    "disclosureField":"nationality",
                    "fieldList":[]
                },
                {
                    "fieldType":"TextInput",
                    "fieldLabel":"Occupation :",
                    "disclosureField":"occupation",
                    "fieldList":[]
                },
                {
                    "fieldType":"TextInput",
                    "fieldLabel":"Additional Information :",
                    "disclosureField":"",
                    "fieldList":[]
                }
                ]
}
</code></pre>