title: Passing a external variable in JSON.parse function
body: <p>I am trying to get a value from json by using the <code>JSON.parse</code> function. My json response is given below:</p>
  
  <pre><code>{
    "rows": 10,
    "os": "0",
    "page": "1",
    "total": "122",
    "projects": {
      "P143841": {
        "id": "P143841",
        "locations": [{
          "geoLocId": "0002220957",
          "latitude": "3.866667",
          "longitude": "11.516667"
        }],
      }
    }
  }
  </code></pre>
  
  <p>I am able to get the value 10 if I do <code>JSON.parse(obj.rows)</code> but if I assign the rows to a variable say <code>var value = rows</code> and then I pass it to the <code>JSON.parse(obj.value)</code> function I got <code>undefined</code>. </p>
  
  <p>P.S. I won't be knowing the names of the response parameters, i.e. i won't know if it will be <code>rows</code> or <code>os</code> quoting from the above example. I will be retrieving them from a database. If I perform the code below:</p>
  
  <pre><code>  for (var i=0;i&lt;length;i++) {
      var value = responseParam_array[i];
      console.log(obj.value);
    }
  </code></pre>
  
  <p>I get the output but any help will be much appreciated.</p>